| Platform SDK: Exchange 2000 Server |
[This is preliminary documentation and subject to change.]
When you receive a meeting request in your inbox, you can accept it, accept it tentatively, reject it, or you can delete it. You typically save the meeting to your calendar folder after accepting the response.
Meeting requests are calendar messages identified by the ICalendarPart.CalendarMethod value "REQUEST."
The CDO Appointment object provides three methods for responding to meeting requests: Accept, AcceptTentative, Decline. Each method returns a Calendar Message object that is addressed to the meeting originator. Each method also updates the status of the meeting in memory so that if you save the meeting to your calendar, the status corresponds to the response you sent. You can also modify the message before sending it.
Note None of the response methods change the meeting request message in the inbox. Typically, the program deletes the meeting request message after a responds is sent.
To respond to a meeting request
The following code example checks the inbox of a specific user. It accepts any meeting request with the word "lunch" in the subject line, and declines all other meetings. Then it 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 iCalMsg2 As 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/" & DomainName & "/MBX/" & UserName & "/inbox/"
CalendarURL = "file://./backofficestorage/" & DomainName & "/MBX/" & UserName & "/calendar/"
'Set the configuration fields for the appointment objects
Config.Fields(cdoSendEmailAddress) = UserName & "@" & DomainName
Config.Fields.Update
'Open the record set for the calendar messages 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 & """')" & _
"WHERE (""DAV:contentclass"" = 'urn:content-classes:calendarmessage')"
Rs.Open , , , adLockOptimistic
'Enumerate the record set and process each calendar message
Rs.MoveFirst
Do Until Rs.EOF
'Open the calendar message
ItemURL = Rs.Fields(CdoDAV.cdoHref).Value
iCalMsg.DataSource.Open ItemURL
iCalMsg.Configuration = Config
'Get each calendar part
For Index = 1 To iCalMsg.CalendarParts.Count
Set iCalPart = iCalMsg.CalendarParts(Index)
Set iAppt = iCalPart.GetUpdatedItem(CalendarURL)
Select Case iCalPart.CalendarMethod
Case "REQUEST"
'Accept any meeting with "lunch" in the subject text
If InStr(1, iAppt.Subject, "lunch", 1) Then
Set iCalMsg2 = iAppt.Accept
Else
Set iCalMsg2 = iAppt.Decline
End If
'Save the meeting
iAppt.DataSource.SaveToContainer CalendarURL
'Send the response
iCalMsg2.Message.Send
Case Else
'See the other examples in this section
End Select
Next Index
'Delete the calendar message
Rs.Delete
Rs.MoveNext
Loop