## Calendar Architecture

For the most part, Connector uses iCalendar for Exchange calendaring. Many iCalendar properties are also automatically promoted to WebDAV properties in the `urn:schemas:calendar:` namespace. In particular:

`DTEND` | `urn:schemas:calendar:dtend`, aka `E2K_PR_CALENDAR_DTEND`
`DTSTART` | `urn:schemas:calendar:dtstart`, aka `E2K_PR_CALENDAR_DTSTART`
`LAST-MODIFIED` | `urn:schemas:calendar:lastmodifiedtime`, aka `E2K_PR_CALENDAR_LAST_MODIFIED`
`UID` | `urn:schemas:calendar:uid`, aka `E2K_PR_CALENDAR_UID`

These (and others) can be used in searches to find specific events or ranges of events.

The iCalendar data can be found in either of two ways:

1. By doing a GET and parsing the iCalendar data out of the returned message body

2. By retrieving the object's `PR_INTERNET_CONTENT` property via a PROPFIND or BPROPFIND.

The second method only works on objects that were created as iCalendar objects (ie, created in Evolution). Objects created by Outlook will not have the `PR_INTERNET_CONTENT` property set, so we have to fall back to using GET. Also note that for some reason, `PR_INTERNET_CONTENT` will not be returned by the SEARCH command. Only by PROPFIND and BPROPFIND.

Exchange uses some non-standard iCalendar properties, and uses some properties in non-standard ways. Here are some of the things we know:

#### All-day events

Exchange does not use iCalendar `DATE`s, only `DATE-TIME`s. To represent an all-day event, it sets the `DTSTART` and `DTEND` to UTC values corresponding to the boundaries of the day in the local time zone, and then sets the `X-MICROSOFT-CDO-ALLDAYEVENT` property to `TRUE`.

#### Free/Busy Transparency

Exchange allows an event to have any of four different free/busy status: `FREE`, `TENTATIVE`, `BUSY`, or `OUTOFOFFICE`. This information is kept in the `X-MICROSOFT-CDO-BUSYSTATUS` property.

Sometimes events created by Outlook or OWA will not have an iCalendar `TRANSP` property, so we must fake it based on the value of `X-MICROSOFT-CDO-BUSYSTATUS`.

Meeting requests sent from Outlook also have an `X-MICROSOFT-CDO-INTENDEDSTATUS` property. This seems to be used to indicate what `BUSYSTATUS` value the organizer intended the recipient to use.

#### Priority

`X-MICROSOFT-CDO-IMPORTANCE` essentially duplicates `PRIORITY`. It can be `MAPI_IMPORTANCE_HIGH` (`0`), `MAPI_IMPORTANCE_NORMAL` (`1`), or `MAPI_IMPORTANCE_LOW` (`2`).

#### Recurrences

An object in an Exchange calendar folder can be one of four different kinds of "instance":

- A non-recurring event.

- The master entry for a recurring appointment.

- A single instance of a recurring appointment. These objects are generated when you view your calendar in OWA, but are redundant with the information in the appointment's master entry.

- An exception to a recurring appointment. (It is not clear that these actually appear in WebDAV.)

The instance type of an object is stored in its `X-MICROSOFT-CDO-INSTTYPE` iCalendar property, which is also visible as the `urn:schemas:calendar:instancetype` (aka `E2K_PR_CALENDAR_INSTANCE_TYPE`) WebDAV property, with one of the values `cdoSingle` (`0`), `cdoMaster` (`1`), `cdoInstance` (`2`), or `cdoException` (`3`), corresponding to the four types described above.

#### Last Action Time

Outlook/Exchange keep track of the last time an action was taken with respect to a meeting request in the `X-MICROSOFT-CDO-REPLYTIME` property. When accepting a meeting request, it should be set in both the saved meeting and the reply to the organizer. It must also be set in a direct booked meeting. Outlook displays this timestamp to the user when viewing the meeting.