Related to recurring appointments, if you attempt to export appointments that recur, there are some things you should know that will generate exceptions when in outlook compatibility mode. To start, Outlook doesn't support all of the recurrence patterns that the Telerik scheduler does. Some of the patterns it doesn't support is:
- Hourly recurrence
- Daily recurrence with a DayOfWeekMask with a value other than EveryDay or Weekdays
- Daily recurrence with an interval other than 1
- Invalid recurrence rule
So if you plan on exporting appointments to Outlook, make sure your appointments don't fall into one of these conditions.
Telerik has a RadScheduler control that operates similar to Outlook; while this is a great control, I experienced an issue with exporting of appointments existing in the scheduler. To summarize these features though, two important features that the RadScheduler has is:
- ExportToICalendar - A static method that takes a bunch of appointments and exports them to an ICS file. Make sure you specify the current time zone you are in, or your appointments will appear at the wrong time slots (more on this later).
- GetAppointmentsInRange - Returns the list of appointments that occur within a specified range. Recurring appointments only have one record in the backend for the entire recurring appointment. But this method figures out which appointments you need to know that exist within the range (more on this later too).
Understanding how these relate to you requires some knowledge about Telerik; maybe I should post on these subjects first, but this is on my mind know, so I wanted to document it. If you use GetAppointmentsInRange to get the appointments for a specified range, recurring appointments come in as a null RecurrenceRule (the rule that specifies the recurrence), but does have the RecurrenceParentID set to the ID of the parent rule.
If you pass this appointment (represented by the Appointment class) into the ExportToICalendar method, this method gets the parent recurrence rule, and not the single instance. This is bad if you want to export a smaller range than the entire recurring appointment. Instead, I'd recommend looping through the returned appointments from GetAppointmentsInRange, and create your own object like:
Appointment newApp = new Appointment();
newApp.Start = oldApp.Start;
newApp.End = oldApp.End;
newApp.Subject = oldApp.Subject;
And you wont have to worry about issues with recurring appointments. You can also check if an appointment is recurring or not by checking out the appointment's RecurrenceState property, and if it's set to NotRecurring, you're OK and don't have to rearrange the object.
So you can take these new appointment records and add them to a list:
List<Appointment> newApps = new List<Appointment>();
//convert old to new appointment records here
What is returned is the textual data that makes up the ICS file. This can be streamed to the browser so the user can export it (more on this later too).
Sorry on all the "more on this later" statements.