Skip to content

Latest commit

 

History

History
55 lines (36 loc) · 2.02 KB

eventOrganizers.md

File metadata and controls

55 lines (36 loc) · 2.02 KB

Calendar Event Ownership

Fields

Each CalendarEvent object should have information about its owner. This data is composed of 4 fields:

  • isOrganizer - defines if the current user is the organizer of this event. The value is calculated automatically.

  • organizerEmail - defines the organizer's e-mail. If not set, the value is copied from the current user's e-mail.

  • organizerDisplayName - defines the name that shows in the UI. If not set, the value is copied from the current user's e-mail.

  • organizerUserId - is organizer email was matched with system user email, his user profile will be linked.

Keep in mind that once set, these fields cannot be changed.

Logic and Behavior

To calculate the isOrganizer param, call the CalendarEvent::calculateIsOrganizer() method.

If the owner data is provided for the CalendarEvent object, the isOrganizer is set to false. Otherwise, an organizer's data should be retrieved from the Calendar owner (usually, a current user), and isOrganizer is set to true.

Additionally, if the CalendarEvent object is a child of the other CalendarEvent, isOrganizer should be set to false, and other organizer fields should be copied from the parent CalendarEvent.

This logic was introduced for synchronization reasons -- to handle the situation when a child CalendarEvents is synchronized before a parent CalendarEvent. The organizer and uid fields help maintain consistency in the database.

API Example

In the API PUT/POST requests, the following fields are supported for a CalendarEvent:

  • organizerEmail
  • organizerDisplayName

GET responses additionally return the isOrganizer and organizerUserId fields values.

GET Query Example

To get a calendar event's organizer via API from the server, send GET request to /api/rest/latest/calendarevents/{id}.

For example:

GET /api/rest/latest/calendarevents/1
{
    "id": 1,
    ...
    "isOrganizer": true,
    "organizerEmail": "[email protected]",
    "organizerDisplayName": "John Smith",
    "organizerUserId": "1",
}