Organizing a Meeting

A meeting is an appointment applicable to one or more messaging users. If you wish to organize a meeting, you start with an appointment that specifies the time and place, and you send it to the other users that are to be involved.

    To organize a meeting using the CDO Library
  1. Create a valid session and log on.
  2. Obtain a calendar folder from the active session.
  3. Create a new AppointmentItem object in the calendar folder using its Messages collection's Add method.
  4. Set the appointment's MeetingStatus property to CdoMeeting.
  5. Set the StartTime and EndTime properties on the appointment, and other properties as applicable, such as Location, Subject, and Text.
  6. Instantiate a Recipients collection for the appointment using its Recipients property.
  7. Add the appropriate messaging users to the Recipients collection.
  8. Set other properties on the AppointmentItem and Recipient objects as appropriate.
  9. Send the appointment to the selected recipients.

The hierarchy of relevant objects is as follows:

Session object
    Folder object
        Messages collection
            AppointmentItem
                Recipients collection
                    Recipient
                RecurrencePattern
            MeetingItem

You create a meeting by setting the AppointmentItem object's MeetingStatus property to CdoMeeting and sending it to one or more recipients. The appointment becomes a meeting as of the moment you call its Send method. In response to this, CDO automatically instantiates a MeetingItem object in your Inbox and every Recipient object's Inbox. Each MeetingItem object becomes a member of the Inbox Messages collection, and it can be treated programmatically just like the regular Message objects in the collection.

To accept a meeting request, a recipient calls the MeetingItem object's Respond method with CdoResponseAccepted in the RespondType parameter. Respond returns another MeetingItem object, which the recipient can Send back to the organizer. Calling Respond with either CdoResponseAccepted or CdoResponseTentative causes an associated AppointmentItem object to be created in the recipient's active calendar folder.

A recipient can call the MeetingItem object's GetAssociatedAppointment method to obtain the associated AppointmentItem object. GetAssociatedAppointment returns the appointment created by CDO in that recipient's calendar folder, not the original appointment from which you created the meeting. You are identified in the Organizer property of every recipient's associated appointment.

To decline a meeting request, a recipient calls Respond with RespondType set to CdoResponseDeclined, and then Send. No AppointmentItem object is created in the recipient's calendar folder in this case.

If you decide to cancel a meeting, set the original appointment's MeetingStatus property to CdoMeetingCanceled and Send it again to all the recipients. Only you can cancel a meeting that you organized.

You can make an appointment recurring by calling its GetRecurrencePattern method, which returns a child RecurrencePattern object describing the recurrence characteristics. You can then change the RecurrencePattern object's properties from their default values to specify the recurrence settings you want. The appointment can later be restored to nonrecurring status with the ClearRecurrencePattern method. It is usually best to make an appointment recurring before generating a meeting from it.

If you wish to edit an individual recurrence of a recurring appointment to make it different from other recurrences in the series, you must first instantiate it. To do this, you perform the following steps:

  1. instantiate a MessageFilter object on the Messages collection using its Filter property;
  2. access the filter's Fields collection through its Fields property;
  3. add Field objects with property tags CdoPR_START_DATE and CdoPR_END_DATE, using the Fields collection's Add method;
  4. set these fields to the start and end date/time of the desired recurrence;
  5. call the Messages collection's GetFirst method to obtain an AppointmentItem object representing the desired recurrence.

A meeting can be obtained from its parent Messages collection using the collection's Item property. To get to the Messages collection in a folder, use the Folder object's Messages property. If you know a meeting's unique identifier, you can obtain it directly from the Session object's GetMessage method.

This code fragment creates and sends an appointment for a meeting at 9:00 the next morning:

Dim objSess As Session 
Dim objCalFold As Folder ' calendar folder to create appointments in 
Dim colAppts As Messages ' appointments collection in calendar folder 
Dim objNewAppt As AppointmentItem 
Dim colRecips As Recipients ' users to be invited to the meeting 
 
Set objCalFold = objSess.GetDefaultFolder(CdoDefaultFolderCalendar) 
Set colAppts = objCalFold.Messages 
Set objNewAppt = colAppts.Add ' no parameters when adding appointments 
With objNewAppt 
   .Importance = CdoHigh 
   .Subject = "Extremely important meeting tomorrow!" 
   .Text = "We will discuss stock distribution." 
   .StartTime = DateAdd("d", 1, DateAdd("h", 9, Date)) 
   .EndTime = DateAdd("h", 1, .StartTime) ' meeting to last one hour 
   Set colRecips = .Recipients ' empty collection of users to invite 
End With 
With colRecips ' populate collection with invitees 
   .Add "John Doe", "jdoe@mycompany.com" ' can't use parentheses! 
   .Add "Mary Coe", "mcoe@mycompany.com" 
   .Resolve ' default to dialog in case of name ambiguities 
End With 
objNewAppt.Send ' appointment becomes a meeting at this moment