Platform SDK: Exchange 2000 Server

Processing Recurring Meeting Exceptions

[This is preliminary documentation and subject to change.]

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 need to loop through the exceptions multiple times. This is less efficient.

The following code example works for exceptions that do not contain "ThisAndFuture" or "ThisAndPrior" values.

[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 following code 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: