Share via


CalendarMessage CoClass

Topic Last Modified: 2006-06-13

Used to send and respond to meeting requests.

CLSID

CD000102-8B95-11D1-82DB-00C04FB1625D

ProgID

CDO.CalendarMessage

Type Library

Microsoft CDO for Exchange 2000 Library

Inproc Server

CDOEX.DLL

Threading Model

Both

Implemented Interfaces

IBodyPart Interface

ICalendarMessage Interface

IDataSource Interface

IMessage Interface

OLE DB Row Access

Supported Bindings

The following table lists IDataSource interface bindings.

Method Target Argument Content Class

Open

Exchange store item URL

urn:content-classes:calendarmessage

OpenObject

IRow _Record IStream _Stream IBodyPart

urn:content-classes:calendarmessage

SaveTo

Exchange store item URL

N/A

SaveToContainer

Exchange store folder URL

N/A

SaveToObject

_Record IStream _Stream IBodyPart

N/A

Remarks

Because meeting requests are sent and received as messages with Multipurpose Internet Mail Extensions (MIME) body parts containing calendar content, this class accesses full messaging functionality with the IMessage, IBodyPart, and IDataSource interfaces.

The IBodyPart interface acts as the root of the hierarchy of MIME body parts in a message.

The CalendarMessage object encapsulates the meeting request as an e-mail message. It also provides access to the ICalendarParts interface that filters for body parts containing calendar content.

The CalendarMessage object serves the protocol requirements for the organizer, who sends a meeting request, and an attendee, who sends a meeting response. The following steps outline a typical scenario for the request and response protocol:

  1. The organizer creates an Appointment object, populated with the necessary property values such as the meeting location and times. The organizer adds Attendee objects to the Attendees collection.
  2. The Appointment object's CreateRequest method creates a CalendarMessage object that is sent with the Send method.
  3. An attendee receives a meeting request in a message containing at least one body part of calendar content. The CalendarMessage object's CalendarParts property accesses an ICalendarParts collection, and its GetUpdatedItem method instantiates an Appointment object with the meeting times, location, and other values from a calendar part in the meeting request message. That Appointment object is saved in the attendee's calendar folder.
  4. An attendee can respond by accepting, accepting tentatively, or declining the meeting request. To respond, the attendee creates a CalendarMessage object using the Appointment object's Accept, AcceptTentative, and Decline methods and sends a response message to the organizer with an optional text message. An attendee can also invite another person to the meeting using a CalendarMessage object.
  5. The organizer receives the response message and derives an Appointment object using the ICalendarParts collection and GetUpdatedItem method. The Attendee collection can be examined to determine the attendees who accepted or declined. The organizer saves the Appointment object to his or her calendar folder using the IDataSource.Save method. This updates the organizer's appointment item with the updated appointment information.

Example


Function SendMeetingRequest(iMbx As CDO.IMailbox, sRecipEmail As String)

  Dim Config    As New Configuration
  Dim iAppt     As New Appointment
  Dim iCalMsg   As CalendarMessage
  Dim iAttn     As Attendee

  ' Set the configuration fields.
  Config.Fields(cdoMailboxURL) = iMbx.BaseFolder
  Config.Fields("CalendarLocation") = iMbx.Calendar
  Config.Fields(cdoSendUsingMethod) = cdoSendUsingExchange
  Config.Fields(cdoSendEmailAddress) = "User1@exchange.example.com"
  Config.Fields.Update

  With iAppt
    .Configuration = Config

    'Set the appointment properties
    .StartTime = #9/5/1999 12:30:00 PM#
    .EndTime = #9/5/1999 1:30:00 PM#
    .Subject = "Lunch meeting"
    .Location = "Building B Cafeteria"
  End With

    ' Add an attendee.
    Set iAttn = .Attendees.Add
    iAttn.Address = sRecipEmail

   ' Create the calendar message and send it.
    Set iCalMsg = iAppt.CreateRequest
    Set iCalMsg.Configuration = Config

    iAppt.DataSource.SaveToContainer iMbx.Calendar

    iCalMsg.Message.Send

    Set SendMeetingRequest = iAppt

End Function