| Platform SDK: Exchange 2000 Server |
As the organizer of a meeting, you can send a calendar message canceling a meeting. Cancellation messages are calendar messages identified by the ICalendarPart.CalendarMethod value "CANCEL."
Instead of deleting the meeting from their calendars, attendees save the updated appointment object that has a MeetingStatus property set to "Cancelled." Calendar client programs typically do not display canceled meetings. For example, Microsoft® Outlook® ignores canceled meetings when building calendar views. CDO does not automatically delete cancelled meetings from the Web Store.
The basic process for processing meeting cancellations is as follows:
The following code example checks the inbox of user12 on an Exchange 2000 Server named exsvr3, in the exchange.microsoft.com domain. It opens all meeting cancellations and saves the updated meeting. It then, deletes the calendar message from the inbox.
Dim InboxURL As String
Dim CalendarURL As String
Dim ItemURL As String
Dim Rs As New ADODB.Recordset
Dim Rec As New ADODB.Record
Dim iCalMsg As New CalendarMessage
Dim iCalPart As ICalendarPart
Dim iAppt As Appointment
Dim Index As Integer
Dim ContentClass As String
Dim Config As New Configuration
InboxURL = "file://./backofficestorage/exchange.microsoft.com/MBX/user12/inbox/"
CalendarURL = "file://./backofficestorage/exchange.microsoft.com/MBX/user12/calendar/"
'Set the configuration fields for the appointment objects
Config.Fields(cdoSendEmailAddress) = "user12@exchange.microsoft.com"
Config.Fields("CalendarLocation") = CalendarURL
Config.Fields.Update
'Open a recordset for the items in the inbox folder
Rec.Open InboxURL
Set Rs.ActiveConnection = Rec.ActiveConnection
Rs.Source = "select ""DAV:href"",""DAV:contentclass"" from scope('shallow traversal of """ & InboxURL & """')"
Rs.Open , , , adLockOptimistic
'Enumerate the recordset, checking each item's content class
Rs.MoveFirst
Do Until Rs.EOF
'get the content class of each item
ContentClass = Rs.Fields("DAV:contentclass").Value
'test content class for calendar message
If ContentClass = "urn:content-classes:calendarmessage" Then
'open calendar message
ItemURL = Rs.Fields(CdoDAV.cdoHref).Value
iCalMsg.DataSource.Open ItemURL
iCalMsg.Configuration = Config
Debug.Print "Message subject: " & iCalMsg.Message.Subject
'get each calendar part
For Index = 1 To iCalMsg.CalendarParts.Count
Set iCalPart = iCalMsg.CalendarParts(Index)
Set iAppt = iCalPart.GetUpdatedItem
Select Case iCalPart.CalendarMethod
Case "CANCEL"
'Save the appointment
iAppt.DataSource.Save
Case Else
'see other examples in this section
End Select
Next Index
'Delete the calendar message
Rs.Delete
End If
Rs.MoveNext
Loop