Issues with creating recurring, finite allday events

  • Thread starter Russ \(msnews.microsoft.com\)
  • Start date
R

Russ \(msnews.microsoft.com\)

Hi,

I'm trying to use the server-side version of CDOEx to create a finite (has
an "end by" date) recurring all day event.
I'm hitting two issues.

First, the code blows up when I try to set the recurrence pattern end type
to "endbyDate" e.g.,
iRecurPattern.PatternEndDate = CDate("10/25/2007 11:00:00 AM")

iRecurPattern.EndType = cdoEndByDate ' DIES HERE

(i get an Invalid procedure or call argument)



If I set the EndType to "cdoNoEndDate", I hit the second problem,

I get a single instance all day event (not a recurring item).



If I go into outlook 2003, open the item, open the recurrence pattern, then
save the item, it converts into the proper recurring alldayevent. I've used
Outlook spy to compare the "correct" item with the "incorrect" item. The
difference seems to be the mapi field "RecurrenceState". (I can't use
MFCMapi - it crashes on these calendar items.)



Does anyone have any idea how to create a finite recurring alldayevent?



My code is below



THanks,

Russ













Sub test_make_recurbanner()

'

' Create recurring banners

'

Dim sURL As String

Dim oConn As New ADODB.Connection

Dim iConfg As CDO.Configuration

Dim oFields As ADODB.Fields

Dim oApp As CDO.Appointment

Dim iRecurPatterns As CDO.IRecurrencePatterns

Dim iRecurPattern As CDO.IRecurrencePattern



sURL = "http://myLab/Exchange/rvi/calendar"

oConn = New ADODB.Connection

oConn.Provider = "exoledb.datasource"



oConn.Open sURL, "", "", 0

If oConn.State = 1 Then

Else

MsgBox "Bad Connection"

Return

End If



Set iConfg = New CDO.Configuration

Set oFields = iConfg.Fields

oFields.Item(CDO.cdoCalendar.cdoTimeZoneIDURN).Value =
CDO.CdoTimeZoneId.cdoEastern

oFields.Item(CDO.CdoConfiguration.cdoSendEmailAddress).Value =
(e-mail address removed)

oFields.Update

Set oApp = New CDO.Appointment

oApp.Configuration = iConfg

oApp.AllDayEvent = True

oApp.StartTime = CDate("4/5/2007 12:00:00 AM")

oApp.endtime = DateAdd("d", 1, oApp.StartTime) 'Add one day to end
time

'oApp.Duration = 1440 'Ignore duration for
now

oApp.Subject = "Test1: Recurring Banner-Every Wed ending 10/25/07"

oApp.TextBody = "Hello..."



' Add recurring appointment

Set iRecurPatterns = oApp.RecurrencePatterns

Set iRecurPattern = iRecurPatterns.Add("Add")

iRecurPattern.Frequency = CDO.CdoFrequency.cdoWeekly

iRecurPattern.Interval = 1 ' every week

iRecurPattern.DaysOfWeek.Add (3) ' every WED

iRecurPattern.PatternEndDate = CDate("10/25/2007 11:00:00 AM")

iRecurPattern.EndType = cdoEndByDate ' DIES HERE

'iRecurPattern.EndType = cdoNoEndDate 'This works - finite end does
not



' Save to the folder

oApp.DataSource.SaveToContainer sURL, , _

ADODB.ConnectModeEnum.adModeReadWrite, _

ADODB.RecordCreateOptionsEnum.adCreateNonCollection, _

ADODB.RecordOpenOptionsEnum.adOpenSource, _

"", ""

oConn.Close



Set oConn = Nothing

Set iConfig = Nothing

Set oFields = Nothing

Set oApp = Nothing

Set iRecurPatterns = Nothing



End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top