Platform SDK: Exchange 2000 Server

CalendarParts CoClass

[This is preliminary documentation and subject to change.]

Defines an object used to manage a collection of CalendarPart objects.

CLSID
Not applicable
ProgID
Not applicable
Type Library
Microsoft CDO for Microsoft Exchange Library
Inproc Server
CDOEX.DLL
Threading Model
Both

Implemented Interfaces

ICalendarParts

Supported IDataSource Bindings

None

Remarks

The CalendarParts COM class cannot be created directly, but it can be returned by using the CalendarPart property on a CalendarMessage object.

Example

The following code example checks the inbox of a user on the Exchange server in an exchange domain. When it finds a calendar message, it prints the subject line of the message and the method of each calendar part in the calendar parts collection.

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