Platform SDK: Exchange 2000 Server |
[This is preliminary documentation and subject to change.]
To cancel an appointment, you delete the appointment from the calendar folder. It’s a good idea to verify that you are deleting an appointment and not a meeting. Unlike Microsoft® Outlook®, CDO does not warn you to notify attendees when the item you are deleting has attendees. If the object being deleted has attendees, it is a meeting; see Canceling a Meeting.
The basic process for canceling an appointment is as follows:
The following code example gets all of the appointments in the calendar of a specific user for all appointments with the subject "Documentation Review Meeting." It then verifies that the appointment has no other attendees, and deletes it.
Dim CalendarURL As String Dim ItemURL As String Dim Rs As New ADODB.Recordset Dim Rec As New ADODB.Record Dim iAppt As New Appointment Dim iAtnds As CDO.IAttendees CalendarURL = "file://./backofficestorage/" & DomainName & "/MBX/" & UserName & "/calendar/" 'Open a record set for the specified items in the calendar folder Rec.Open CalendarURL Set Rs.ActiveConnection = Rec.ActiveConnection Rs.Source = "SELECT ""DAV:href"", ""urn:schemas:httpmail:subject"" " & _ "FROM scope('shallow traversal of """ & CalendarURL & """')" & _ "WHERE (""urn:schemas:httpmail:subject"" = 'Documentation Review Meeting')" Rs.Open , , adOpenStatic, adLockOptimistic 'Enumerate the record set and delete each appointment found Rs.MoveFirst Do Until Rs.EOF 'Verify there are no attendees by checking attendee count ItemURL = Rs.Fields(CdoDAV.cdoHref).Value iAppt.DataSource.Open ItemURL Set iAtnds = iAppt.Attendees 'If attendee count = 1, delete this appointment If iAtnds.Count = 1 Then Rs.Delete End If Rs.MoveNext Loop