Click here to Skip to main content
13,299,727 members (55,653 online)
Click here to Skip to main content
Add your own
alternative version


10 bookmarked
Posted 30 Nov 2007

Adding Updating Calendar,Tasks Appointment using CDO Object

, 30 Nov 2007
Rate this:
Please Sign up or sign in to vote.
How to Add or Update Exchange Calendar/Tasks files using CDOAppointment object


This article describes how to add or update Calendar/Tasks Appointment items using the CDO Appointment object.

Using the Code

Open the Exchange Server connection:

Dim ADOExchangeConn as new ADODB.Connection
Dim MailBoxUrl as string = "" 
ADOExchangeConn.Provider = "ExOLEDB.DataSource"
ADOExchangeConn.Open(MailBoxURL, ExchangeUserName, ExchangePassword, 0)

The MailBoxURL can be described as follows:

  • - Exchange IP Address
  • Exchange - Server Name
  • test - User Name
  • Calendar - Folder
  • 231.eml - eml filename

Define the CDO Appointment object:

Dim objCDOApp as CDO.Appointment

To add subject, we need to set:

objCDOApp.Fields.Item( =

Then, set subject as follows:

objCDOApp.Subject = sDisplayName
objCDOApp.Priority = 0
objCDOApp.AllDayEvent = True
objCDOApp.BusyStatus = "FREE"
objCDOApp.Duration = 86400
objCDOApp.Fields("urn:schemas:calendar:reminderoffset").Value = 64800
'''we can also Set objCDOApp.Fields("ReminderOffSet").Value = 64800

If event is a One Day event, then StartTime should be like "Date 00:00:00 AM", otherwise Calendar will show the same event (appointment) on two successive dates. Also, converting date to GMT is necessary:

Dim dtTemp1 As Date = DatePart(DateInterval.Month, strStartTime) & "/" & _
                               DatePart(DateInterval.Day, strStartTime) & "/" & _
                               DatePart(DateInterval.Year, strStartTime) & 
                               " 00:00:00 AM"
Dim iGmtDiff As Double = 
    DateDiff(DateInterval.Minute, System.DateTime.UtcNow(), System.DateTime.Now())
Dim dtTemp2 As Date = DateAdd(DateInterval.Minute, -iGmtDiff, dtTemp1)
objCDOApp.StartTime = dtTemp2.Date                   
dtTemp2 = DateAdd(DateInterval.Day, 1, dtTemp2)
objCDOApp.EndTime = dtTemp2.Date
 objCDOApp.Contact = "H"
 objCDOApp.TextBody = "There is meeting today with H"
 // This line is required to update objCDOApp.Fields("ReminderOffSet").Value = 600

Use the "var" button to wrap Variable or class names in <code> tags like this:

 objCDOApp.DataSource.SaveTo(MailboxUrl, , ADODB.ConnectModeEnum.adModeReadWrite, 
    ADODB.RecordOpenOptionsEnum.adOpenSource,  exchangeusername, exchangepwd)
'''  'SaveTo' function adds new eml also updates if the eml exists.


  • 30th November, 2007: Initial post


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Hrushikesh Mokashi
Web Developer
India India
No Biography provided

You may also be interested in...


Comments and Discussions

-- There are no messages in this forum --
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.171207.1 | Last Updated 30 Nov 2007
Article Copyright 2007 by Hrushikesh Mokashi
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid