Become a Columnist Microsoft Exchange Site Microsoft Support SiteMSDN Exchange Site

       How did you like this article? Please vote and let us know.          

Subscribe to OutlookExchange
Anderson Patricio
Ann Mc Donough
Bob Spurzem
Brian Veal
Catherine Creary
Cherry Beado
Colin Janssen
Collins Timothy Mutesaria
Drew Nicholson
Fred Volking
Glen Scales
Goran Husman
Guy Thomas
Henrik Walther
Jason Sherry
Jayme Bowers
John Young
Joyce Tang
Justin Braun
Konstantin Zheludev
Kristina Waters
Kuang Zhang
Mahmoud Magdy
Martin Tuip
Michael Dong
Michele Deo
Mitch Tulloch
Nicolas Blank
Pavel Nagaev
Ragnar Harper
Ricardo Silva
Richard Wakeman
Russ Iuliano
Santhosh Hanumanthappa
Shannal L. Thomas
Steve Bryant
Steve Craig
Todd Walker
Tracey J. Rosenblath

 

 
  Create a recurring meeting using CDO for Exchange 2000
By Russ Iuliano, Sumatra Development LLC

The real world is full or recurrences -- from your weekly newsmagazine and your daily paper to the monthly sales update and the quarterly results. In ordinary life recurring functions are crucial. For Outlook calendar applications, it is beyond necessary.

It was therefore surprising that as part of our meetingmaker to Exchange migration application we found it almost impossible to convert meetingmaker recurrences to Outlook recurrences. The functionality is documented in the CDO package, but the instantiation and implementation of it is not clear.

Doing this in Outlook itself is straight-forward, but trying to do it in the context of an application that interacts with Outlook via CDO is problematic.

The purpose of this article is to make clear how to set up recurring meetings and appointments via the CDO calls for Exchange 2000, so that others will benefit from our experiences.

Background

Sumatra develops calendar conversion software. Our main business is converting meetingmaker servers to Microsoft® Exchange 2000 (see http://www.sumatra.com).

One of the most difficult problems we faced in inserting meetingmaker data into Exchange was creating recurring meetings. In our conversion work, we've found almost 10% of meetings and appointments are recurring. The client had seen and rejected solutions that turned recurring meetings into many single instances (this happens a lot with PDA device synchronization). This wasn't a problem that we could ignore.

Why is it so difficult to create a meeting that recurs every Tuesday and Thursday in CDO? We read the CDO SDK documentation, browsed a dozen books, and could only find the most basic examples. In this article we'll fill in the missing pieces, and provide Visual Basic code.

There are two types of recurring meetings:

  • Meetings with a simple recurrence pattern (i.e. meetings that recur every nth period. For example, every day, every second week, quarterly), and,
  • Meetings with a complex recurrence pattern (e.g. meetings that recur every Tuesday and Thursday).

On average, 60% of recurring meetings use a simple recurrence pattern. (This data comes from our study of real-world data sets.) The September 2001 Microsoft® Exchange 2000 SDK development tools provides the reference material for CDO's IAppointment and IRecurrence interfaces. We used the IRecurrence interface to create these simple recurrence patterns.

The remaining 40% use complex recurrence patterns. The SDK material didn't cover these cases. Neither did Outlook Exchange resources and documents page. Questions posed to the Outlook and Exchange development community provided us with enough information to solve this puzzle.

Let's pretend we have to ship a product on May 1, 2002. We want to have weekly product development meetings every Friday at 1pm through the end of March. Then as our release date approaches, we'll shift to every Tuesday and Thursday from April 1st through April 25th. This will give us plenty of time for QA! ;)

The solution

We use a simple recurrence pattern to create a one-hour meeting that starts on 3/1/2002 at 1pm. This meeting has four attendees, two are required, one is optional, and one an informational-only attendee. This meeting occurs once per week, and runs for five weeks. (See Figure A) We use the RecurrencePatterns.Add("ADD") to add a recurrence pattern to this meeting. Within this block, we define the first day of the week to be Sunday (.FirstDayOfWeek = cdoSunday), the frequency of the recurrence pattern to be weekly (.Frequency = cdoWeekly), the interval to be every week (.Interval = 1), and the number of instances of the pattern to be five (.Instances = 5).

 

Figure A
A Simple Recurrence Pattern
(Weekly Recurring Meeting)

'Sample Recurring Meeting Code with Simple Recurring Pattern '(c) 2001,2002 Sumatra Development LLC ' This code is provided "as is" for instructional purposes only. ' Sumatra expressley disclaims any warranty or condition for this software. ' Dim cnfg As CDO.Configuration
Dim objAppt As CDO.Appointment
Dim urlCalendar As String
urlCalendar = "file://./backofficestorage/yourdomain.com/MBX/sue/Calendar/"
Set cnfg = New CDO.Configuration
With cnfg
    'Set the default configuration for the meeting organizer
    .Fields(cdoSendEmailAddress) = "sue@yourdomain.com"
    .Fields(cdoTimeZoneIDURN) = cdoEastern 'default eastern time zone
    .Fields.Update
End With
Set objAppt = New CDO.Appointment 'Define new appointment
With objAppt
    .Configuration = cnfg    'Link the configuration and appointment
    .Priority = cdoPriorityNormal
    .StartTime = "1:00 PM 3/1/2002"
    .EndTime = "2:00 PM 3/1/2002"
    .Subject = "Product Development - Status Meeting"
    .Location = "Development Conference Room"
    .TextBody = "Product marketing will outline the plans and progress for " & _
                    "the new product under development (scheduled for release on May 1st.)"
    .Transparent = cdoOpaque 'forces appt to show up in calendar
    'Weekly meeting (every Friday)for five weeks
    With .RecurrencePatterns.Add("ADD")
       .FirstDayOfWeek = cdoSunday
       .Frequency = cdoWeekly
       .Interval = 1
       .Instances = 5
    End With
End With
'Two required attendees
objAppt.Attendees.Add _
    "fred@yourdomain.com, " & _
    "betty@yourdomain.com"
'One optional attendee
With objAppt.Attendees.Add
    .Address = "cathy@yourdomain.com"
    .Role = cdoOptionalParticipant
End With
'One attendee invited "for informational purposes"
With objAppt.Attendees.Add
    .Address = "bill@yourdomain.com"
    .Role = cdoNonParticipant
End With
'Send meeting request
objAppt.CreateRequest.Message.Send
'Save meeting in organizer's calendar
objAppt.DataSource.SaveToContainer urlCalendar
Set cnfg = Nothing
Set objAppt = Nothing


 

As our May 1st deadline approaches, we shift our meeting frequency into high-gear. We create a new meeting make a one-hour meeting every Tuesday and Thursday from April 1st through April 25th. (See Figure B) This requires we use a complex recurrence pattern.

First, the meeting starts on April 2, 2002. We eliminate the meeting end date (the .EndDate value). Instead, we define the ending period as the PatternEndDate value in the recurrence pattern (.PatternEndDate = "2:00 PM 4/25/2002"). Since we've dropped the end date value, we must set the meeting duration (.Duration =3600) (this is one hour in seconds!) Now here's the tricky part. We use the DaysOfWeek.Add method to add the Tuesday and Thursday Recurrence Pattern (.DaysOfWeek.Add cdoTuesday and .DaysOfWeek.Add cdoThursday)

Finally, because this meeting is so important, we've changed the meeting configuration to remind the user one-hour before the meeting (Fields(cdoReminderOffset) = 3600).

 

Figure B
A Complex Recurrence Pattern
(Twice per week until 4/25/02)

'Sample Recurring Meeting Code with complex recurring pattern '(c) 2001,2002 Sumatra Development LLC ' This code is provided "as is" for instructional purposes only. ' Sumatra expressley disclaims any warranty or condition for this software. ' Dim cnfg As CDO.Configuration
Dim objAppt As CDO.Appointment
Dim urlCalendar As String
urlCalendar = "file://./backofficestorage/yourdomain.com/MBX/sue/Calendar/"
Set cnfg = New CDO.Configuration
With cnfg
    'Set the default configuration for the meeting organizer
    .Fields(cdoSendEmailAddress) = "sue@yourdomain.com"
    .Fields(cdoTimeZoneIDURN) = cdoEastern 'default eastern time zone
    .Fields(cdoReminderOffset) = 3600 'reminder set to one hour
    .Fields.Update
End With
Set objAppt = New CDO.Appointment 'Define new appointment
With objAppt
    .Configuration = cnfg    'Link the configuration and appointment
    .Priority = cdoPriorityNormal
    .StartTime = "1:00 PM 4/02/2002"
    .Duration = 1 * 60 * 60 'duration must be in seconds!
    .Subject = "Product Development - Status Meeting"
    .Location = "Development Conference Room"
    .TextBody = "Product marketing will outline the plans and progress for " & _
                    "the new product under development (scheduled for release on May 1st.)"
    .Transparent = cdoOpaque 'forces appt to show up in calendar
    'Weekly meeting (every Friday)for five weeks
    With .RecurrencePatterns.Add("ADD")
       .FirstDayOfWeek = cdoSunday
       .Frequency = cdoDaily
       .PatternEndDate = "2:00 PM 4/25/2002"
                
       'Set meeting every Tuesday AND Thursday
       .DaysOfWeek.Add cdoTuesday
       .DaysOfWeek.Add cdoThursday
    End With
End With
'Two required attendees
objAppt.Attendees.Add _
    "fred@yourdomain.com, " & _
    "betty@yourdomain.com"
'One optional attendee
With objAppt.Attendees.Add
    .Address = "cathy@yourdomain.com"
    .Role = cdoOptionalParticipant
End With
'One attendee invited "for informational purposes"
With objAppt.Attendees.Add
    .Address = "bill@yourdomain.com"
    .Role = cdoNonParticipant
End With
'Send meeting request
objAppt.CreateRequest.Message.Send
'Save meeting in organizer's calendar
objAppt.DataSource.SaveToContainer urlCalendar
Set cnfg = Nothing
Set objAppt = Nothing



Conclusion

Calendars are not a one-night so much as an on-going relationship. As in any on-going relationship you want to have it all. The part that was missing for us (and many other CDO developers) was the recurring meeting part. Having cemented that in place we can now all move on to better client relationships.


Download the Visual Basic Code

RETURN to Sumatra's Article Index


Disclaimer: Your use of the information contained in these pages is at your sole risk. All information on these pages is provided "as is", without any warranty, whether express or implied, of its accuracy, completeness, fitness for a particular purpose, title or non-infringement, and none of the third-party products or information mentioned in the work are authored, recommended, supported or guaranteed by Pro Exchange. OutlookExchange.Com and Pro Exchange shall not be liable for any damages you may sustain by using this information, whether direct, indirect, special, incidental or consequential, even if it has been advised of the possibility of such damages.

© Copyright Pro Exchange, Inc., 2006