| Platform SDK: Exchange 2000 Server |
[This is preliminary documentation and subject to change.]
Accesses any component of the CalendarParts collection on the CalendarMessage object.
None
A CalendarPart object represents a body part that contains calendar content. You can examine each calendar part's appointment information with this object's IAppointment interface. If you want to work with a CalendarMessage object instantiated from a calendar part, use the GetAssociatedItem method.
The following example checks the inbox of a user on the Exchange server in a specific domain . When it finds a calendar message, it prints the subject line of the message and the method of each calendar part.
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 the content class for each calendar message
If ContentClass = "urn:content-classes:calendarmessage" Then
'Open the 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
Debug.Print "Part " & Index & " Method: " & iCalPart.CalendarMethod
Next Index
'Delete the calendar message from the inbox
Rs.Delete
End If
Rs.MoveNext
Loop