Platform SDK: Exchange 2000 Server |
[This is preliminary documentation and subject to change.]
The organizer of a meeting can cancel a meeting and notify all of the attendees. To do so the organizer changes the meeting status to canceled, and sends an updated Calendar Message to the attendees.
The organizer can also remove some of the attendees from the meeting without canceling the entire meeting. To remove some attendees, the organizer specifies the attendees' e-mail addresses in the string passed to the IAppointment.Cancel method. To cancel the entire meeting, call the Cancel method without any parameters.
The basic process for canceling a meeting is as follows:
The following code example gets all of the meetings in the calendar of a specific user with the subject "Documentation Review Meeting." It verifies that the user is the organizer, it then sends the cancellation message to the attendees, and finally it deletes the meeting from the calendar folder.
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 Dim iCalMsg As CDO.CalendarMessage Dim Config As New Configuration Dim Address As String Dim Subject 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 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"" " & _ "FROM scope('shallow traversal of """ & CalendarURL & """')" & _ "WHERE (""urn:schemas:httpmail:subject"" = 'Documentation Review Meeting')" Rs.Open , , adOpenStatic, adLockOptimistic 'Enumerate the recordset Rs.MoveFirst Do Until Rs.EOF 'Verify that this user is the organizer ItemURL = Rs.Fields(CdoDAV.cdoHref).Value iAppt.DataSource.Open ItemURL, , adModeReadWrite Set iAtnds = iAppt.Attendees For Index = 1 To iAtnds.Count If iAtnds.Item(Index).IsOrganizer And iAtnds.Item(Index).Address = Address Then 'This user is the organizer iAppt.Configuration = Config Set iCalMsg = iAppt.Cancel 'To remove attendees, pass their addresses to the Cancel method 'Set iCalMsg = iAppt.Cancel("someone@microsoft.com,another@microsoft.com") iCalMsg.Message.TextBody = "This meeting is canceled." iCalMsg.Message.Send 'Delete the appointment from the calendar folder (optional) Rs.Delete Exit For 'Stop checking attendees End If Next Index Rs.MoveNext Loop