Platform SDK: Exchange Server |
After creating a recurring task, you can specify exceptions to the recurrence pattern. For example, you can define a task that recurs on Monday of every week, except for those weeks in which Monday is a holiday.
To create an exception to a recurring task
The following sample code creates an exception to a recurring task:
Public Sub AddException2(objItem As Object) Dim objException As Object Dim dt As Date 'Note: objItem is a RecurringTask object. 'Create an exception that deletes an instance of the recurrence pattern. dt = #11/16/95# Set objException = objItem.Exceptions.New 'Set the desired properties on the item. objException.SetProperties InstanceDate:=LConvertTo32bitDate(dt), Deleted:=True 'Release the object. objException = Nothing 'Create an exception that modifies an instance of the recurrence pattern. dt = DateAdd("w", 1, dt) Set objException = objItem.Exceptions.New 'Set the desired properties on the item. objException.SetProperties InstanceDate:=LConvertTo32bitDate(dt), Deleted:=False Text:="Exception" 'Release the object. objException = Nothing End Sub
You can also create exceptions to recurring tasks by deleting or modifying specific instances in the merged tables.
After you delete an instance of the recurring task, Schedule+ automatically removes that instance from the Tasks table and creates a new item in the Exceptions table. To determine which items are exceptions, an application can scan the Exceptions table and examine the properties of each Exception item. For example, the InstanceDate property indicates the date on which the item would have occurred if it had not been deleted.
The series of steps for creating a recurring appointment or event is similar, but you must delete instances of the recurring appointment from the Appointments table and instances of the recurring event from the Events table.