Recurrence
- 3 minutes to read
Overview
Appointments can be either simple occurring only once in the specified time interval), or recurring. To determine whether an appointment is recurring, use the AppointmentItem.IsRecurring property.
Different types of appointments can be recurring. Use the AppointmentItem.Type property to determine an appointment’s type. A recurring appointment can either be a base (a Pattern) or a recurring instance (occurrence). Recurring instances can either be a regular Occurrence, or an exception (a ChangedOccurrence or a DeletedOccurrence). A regular recurring appointment is visually indicated with the icon; an exception is visually indicated with the icon. The following sections describe the differences between these recurring appointments.
Base Recurring Appointment and Recurrence Pattern
Every recurring appointment’s series is based on the pattern appointment, available using the AppointmentItem.RecurrencePattern property of all other appointments in the series. The Pattern appointment contains information about a recurrence: it sets the recurrence series’ start date and time and specifies the rule according to which a series is repeated. This recurrence rule is accessed via the pattern’s AppointmentItem.RecurrenceInfo property.
The Pattern appointment is stored in the SchedulerControl.AppointmentItems collection. All other Occurrence appointments (except for ChangedOccurrence and DeletedOccurrence) are not stored in any collection. They are automatically generated at runtime according to the pattern appointment’s RecurrenceInfo.
Note
Recurring appointments’ series can be either finite or infinite. Occurrence appointments are not stored in any collection to avoid a stack overflow for infinitive recurring series.
End-users can edit an appointment’s recurrence pattern at runtime using the Recurrence Window.
The following recurrence types are supported:
Recurrence Exceptions
Only the Pattern appointment is stored in the underlying data source. Regular appointments in the recurring series (Occurrences) are generated at runtime; you cannot find them in the SchedulerControl.AppointmentItems collection and they are not saved to the data source.
However, a recurring series may contain several exceptions. Exceptions are the Occurrence appointments which have either been changed or deleted and no longer meet the common recurrence rule the pattern appointment specifies.
Note
All occurrences within a recurring series are associated with the same resource. A changed occurrence can differ from its pattern by a subject, description, label, status, start time, and end time.
A collection of exceptions for a particular recurrence pattern is accessible using the pattern’s AppointmentItem.GetExceptions method. This collection contains both AppointmentType.ChangedOccurrence and AppointmentType.DeletedOccurrence appointment types. Note that exceptions replace regular occurrences: the Occurrence appointment with the same AppointmentItem.RecurrenceIndex is not generated for each appointment in the exception’s collection.
Note
Call the AppointmentItem.RestoreOccurrence method to restore the original occurrence from an exception.