| Platform SDK: Exchange 2000 Server |
[This is preliminary documentation and subject to change.]
As the organizer of a meeting, you can send updates to the attendees of the meeting using a calendar message. CDO returns an error if you call the IAppointment.CreateRequest method for a meeting you are not the organizer of.
Attendees process the update messages the same way they process any other calendar message. The ICalendarMessage.CalendarParts.GetUpdatedItem method compares the new calendar message with the existing meeting. It returns an Appointment object that can be saved to the calendar folder The updated meeting overwrites the existing meeting. For more information on processing meeting updates, see Responding to a Meeting Request.
The basic process for sending meeting updates is as follows:
The following code example checks all of the meetings in the calendar of user12, located on server exsvr3, in the exchange.microsoft.com domain. For meetings originated by user12, it changes any meeting in the "Flamingo Room" to the "Mount Rainier Room," and it sends an update to all attendees.
Dim CalendarURL As String
Dim ItemURL As String
Dim Rec As New ADODB.Record
Dim Rs As New ADODB.Recordset
Dim iDsrc As CDO.IDataSource
Dim iAtnds As CDO.IAttendees
Dim Config As New CDO.Configuration
Dim iAppt As New CDO.Appointment
Dim iCalMsg As CDO.CalendarMessage
Dim iMsg As CDO.Message
Dim Target As String
Dim NewValue As String
Dim Location As String
Dim Address As String
Dim Index As Integer
Target = "Flamingo Room"
NewValue = "Mount Rainier Room"
'Using the Exchange OLE DB provider
CalendarURL = "file://./backofficestorage/exchange.microsoft.com/MBX/user12/calendar/"
'Set the configuration for the message
Config.Fields(cdoSendEmailAddress) = "user12@exchange.microsoft.com"
Config.Fields("CalendarLocation") = CalendarURL
Config.Fields.Update
'set address of user for comparing with attendee value
Address = "MAILTO:" & Config.Fields(cdoSendEmailAddress)
'Open a record set for the items in the calendar folder
Rec.Open CalendarURL
Set Rs.ActiveConnection = Rec.ActiveConnection
Rs.Source = "SELECT ""DAV:href"", ""urn:schemas:calendar:location"" from scope('shallow traversal of """ & CalendarURL & """')"
Rs.Open
'Enumerate the record set, checking each item's location
Rs.MoveFirst
Do Until Rs.EOF
'get the location of each item
Location = Rs.Fields(CdoCalendar.cdoLocation).Value
'test for organizer and desired location
If (Location = Target) Then
'open appointment in read/write mode
ItemURL = Rs.Fields(CdoDAV.cdoHref).Value
Set iDsrc = iAppt
iDsrc.Open ItemURL, , adModeReadWrite
'verify this user is organizer by checking attendee property
Set iAtnds = iAppt.Attendees
'If appointment has attendess and this user is organizer send an update
'otherwise just save update to calendar
If iAtnds.Count > 1 Then
For Index = 1 To iAtnds.Count
If iAtnds.Item(Index).IsOrganizer And iAtnds.Item(Index).Address = Address Then
'update the appointment location
iAppt.Location = NewValue
'save the appointment
iDsrc.Save
'set the configuration
iAppt.Configuration = Config
'create a calendar message
Set iCalMsg = iAppt.CreateRequest
'send the update to the attendees
Set iMsg = iCalMsg.Message
iMsg.TextBody = "Automated update - please note new location"
iMsg.Send
End If 'user is organizer
Next Index
Else 'appointment has only one attendee
iAppt.Location = NewValue
iDsrc.Save
End If 'appointment has attendees
End If 'location = target
Rs.MoveNext
Loop