Processing Recurring Meeting Exceptions
Topic Last Modified: 2006-06-12
There are two ways to process exceptions in recurring meetings. If the meeting does not contain exceptions with a RecurrenceIDRange property value of ThisAndFuture or ThisAndPrior, you can process each exception exactly once. This is an efficient way to process exceptions.
If the meeting contains ThisAndFuture or ThisAndPrior exceptions, you must loop through the exceptions multiple times. This is less efficient.
The code in the following example works for exceptions that do not contain ThisAndFuture or ThisAndPrior values:
Example
Visual Basic
Dim recurid As Date
Dim obExAppt As CDO.Appointment
Dim obReq As CDO.CalendarMessage
Dim obEx As CDO.IException
For Each obEx In obAppt.Exceptions
'To make sure we process next exception if we can't process this one
On Error GoTo NextException
If obEx.Type = "Modify" Then
recurid = obEx.RecurrenceID
'Found an exception: process it
Set obExAppt = obAppt.GetFirstInstance(recurid, recurid)
Set obReq = obExAppt.CreateRequest ' OR Invite OR Cancel, etc.
obReq.Message.Send
End If
NextException:
End
The code in the following example works for exceptions that contain ThisAndFuture or ThisAndPrior values:
Visual Basic
While (1)
On Error GoTo NextInstance
obExAppt = obAppt.GetNextInstance
If obExAppt.Fields("urn:schemas:calendar:instancetype") = cdoException Then
Found an exception: process it
Set obExAppt = obAppt.GetFirstInstance(recurid, recurid)
Set obReq = obExAppt.CreateRequest ' OR Invite OR Cancel, etc.
obReq.Message.Send
End If
NextInstance:
'Check for err.Number = DISP_E_BADINDEX: 0x8002000b (winerror.h)
If Err.Number = 2147614731# Then GoTo Quit
End
Quit: