Exchange Calendar with CDO
Exchange Calendar with CDO
CDO (Collaboration Data Objects) for Exchange 2000 provides a COM-based API for creating and managing calendar appointments, meeting requests, and free/busy data.
CDO Library Reference
| Library | ProgID | Purpose |
|---|---|---|
| CDO 1.21 | MAPI.Session | Legacy MAPI access: logon, messages, folders |
| CDO for Exchange 2000 | CDO.Person, CDO.Appointment | Web Storage System: calendar, contacts, tasks via URL addressing |
| CDOEXM | CDOEXM.MailboxStoreDB | Exchange management: mailbox provisioning, store admin |
Creating an Appointment with CDO
' Create a calendar appointment using CDO for Exchange 2000
Dim strCalURL
strCalURL = "http://mail.corp.flamenet.io/exchange/jsmith/Calendar/"
Dim iAppt
Set iAppt = CreateObject("CDO.Appointment")
iAppt.StartTime = "2001-06-15T09:00:00Z"
iAppt.EndTime = "2001-06-15T10:00:00Z"
iAppt.Subject = "Project Review Meeting"
iAppt.Location = "Conference Room B"
iAppt.TextBody = "Review Q2 project milestones and deliverables."
iAppt.BusyStatus = 2 ' olBusy
' Add attendees
Dim iAttendee
Set iAttendee = iAppt.Attendees.Add
iAttendee.Address = "mailto:jdoe@corp.flamenet.io"
iAttendee.Role = 1 ' cdoRequiredParticipant
' Save to the calendar folder
Dim strItemURL
strItemURL = strCalURL & "project-review.eml"
Dim iFields
Set iFields = iAppt.Fields
iAppt.DataSource.SaveToContainer strCalURL, _
iAppt, _
cdoAdoStream
WScript.Echo "Appointment created."
Reading Free/Busy Data
Exchange stores free/busy data in a public folder. You can query it via the urn:schemas:calendar: namespace or use the CDO.CalendarMessage object to process meeting requests and responses.
Common Pitfalls
- CDO 1.21 requires a MAPI profile: it cannot use HTTP URLs. Use CDO for Exchange 2000 (the HTTP-based version) for web applications.
- Time zones: Always specify UTC times and include the
urn:schemas:calendar:dtstartanddtendfields with the Z suffix. - Meeting requests require the
CDO.CalendarMessagewrapper to generate iCalendar-formatted invitations.