Platform SDK: Exchange 2000 Server

Canceling a Meeting

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

  1. Open the calendar folder using an ADODB record set. Use the adOpenStatic and adLockOptimistic options on the Open method to enable deleting members of the record set.
  2. Locate the meeting you want to delete and open it using an Appointment object. Verify that you are the organizer. Be sure to open the appointment in read/write mode using the adModeReadWrite option.
  3. Create a Calendar Message object using the IAppointment.Cancel method. Pass a list of attendees to be removed, or do not pass any parameters to cancel the entire meeting.
  4. Add any desired text to the Calendar Message object.
  5. Send the Calendar Message object using the IMessage.Send method.
  6. Delete the canceled meeting from the calendar folder (optional).

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.

[Visual Basic]
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