Platform SDK: Exchange 2000 Server |
[This is preliminary documentation and subject to change.]
Recurring appointments and meetings have one master and one or more recurring instances. To cancel an entire series of a recurring appointment or meeting, you need to cancel the master appointment or meeting. Each recurring instance has a GetRecurringMaster method that returns its master appointment or meeting.
To cancel a single instance of a recurring appointment or meeting, open the instance and cancel it. You cancel single instances the same way you cancel a single appointment or meeting; see Canceling an Appointment or Canceling a Meeting.
The basic process for canceling a recurring appointment or meeting is as follows:
Note Once you delete the master appointment or meeting for an instance, do not try to delete the master again for another instance of the same master.
The following code example gets meetings in the specified date range from the calendar of a specific user with the subject "Documentation Review Meeting." It then gets the master meeting, verifies that the user is the organizer, and finally cancels the entire recurring meeting.
Dim CalendarURL As String Dim ItemURL As String Dim Rs As New ADODB.Recordset Dim Rec As New ADODB.Record Dim Rec2 As New ADODB.Record Dim iAppt As New CDO.Appointment Dim iAppt2 As CDO.Appointment Dim iAtnds As CDO.IAttendees Dim Config As New CDO.Configuration Dim iCalMsg As CDO.CalendarMessage Dim Address As String Dim Index As Integer CalendarURL = "file://./backofficestorage/" & DomainName & "/MBX/" & UserName & "/calendar/" 'Set the configuration fields Config.Fields(cdoSendEmailAddress) = UserName & "@" & DomainName Config.Fields.Update Set iAppt.Configuration = Config 'Set the address of the user for comparing with the attendee value Address = "MAILTO:" & UserName & "@" & DomainName 'Open the record set for the items in the calendar folder Rec.Open CalendarURL Set Rs.ActiveConnection = Rec.ActiveConnection Rs.Source = "SELECT ""DAV:href"", " & _ " ""urn:schemas:httpmail:subject"", " & _ " ""urn:schemas:calendar:dtstart"", " & _ " ""urn:schemas:calendar:dtend"" " & _ "FROM scope('shallow traversal of """ & CalendarURL & """') " & _ "WHERE (""urn:schemas:calendar:dtstart"" >= CAST(""1999-10-01T08:00:00Z"" as 'dateTime')) " & _ "AND (""urn:schemas:calendar:dtend"" <= CAST(""1999-11-01T08:00:00Z"" as 'dateTime'))" & _ "AND (""urn:schemas:httpmail:subject"" = 'Documentation Review Meeting')" Rs.Open , , adOpenStatic, adLockOptimistic 'Enumerate the record set Rs.MoveFirst Do Until Rs.EOF ItemURL = Rs.Fields(CdoDAV.cdoHref).Value iAppt.DataSource.Open ItemURL, , adModeReadWrite Set iAtnds = iAppt.Attendees For Index = 1 To iAtnds.Count 'Check if this user is the organizer If iAtnds.Item(Index).IsOrganizer And iAtnds.Item(Index).Address = Address Then 'This user is the organizer Set iAppt2 = iAppt.GetRecurringMaster(CalendarURL) 'Get the master 'If already master, returns itself 'Create a cancelation message iAppt2.Configuration = Config Set iCalMsg = iAppt2.Cancel iCalMsg.Message.TextBody = "This meeting is canceled." iCalMsg.Message.Send 'Delete the master from the calendar folder (optional) ItemURL = iAppt2.Fields(CdoDAV.cdoHref) Rec2.Open ItemURL, , adModeReadWrite Rec2.DeleteRecord Exit Do 'Stop processing meeting instances End If Next Index Rs.MoveNext Loop