Bug with recurring appointments

T

Tom Trulley

Is there a bug with recurring appointments?

I have an Appointment that is a recurring appointment. For example the
appointment begins on 01-27-2004 and occurs every day. When I filter
my appointments for example to 01-30-2004 and do the following:

MsgBox AppointmentItem.End --> Shows 01-30-2004
tmp = AppointmentItem.EntryID
MsgBox AppointmentItem.End --> Shows 01-27-2004

Why did the end date change?
 
K

Ken Slovak - [MVP - Outlook]

Do you have IncludeRecurrences set to True for the Items collection of
that folder? Are you getting the original master recurring item, then
getting the RecurrencePattern and then getting the occurrence you are
interested in using the GetOccurrence method?

What version of Outlook are you using?
 
T

Tom Trulley

This is how I get the items

Dim items
Set items = myFolder.Items
items.Sort "[Start]"
items.IncludeRecurrences = True
Dim strFind
strFind = "[Start] <= """ & FormatDateTime(currentDate, vbShortDate)
& " 11:59 PM""" & " AND [End] > """ & FormatDateTime(currentDate,
vbShortDate) & " 12:00 AM"""
Dim myAppts
Set myAppts = items.Restrict(strFind)
For Each AppointmentItem in myAppts
[...]

I'm using Outlook 2003 with Exchange Server 2003
 
K

Ken Slovak - [MVP - Outlook]

Hmm, are you using cached Exchange mode? If so what does the
connection show in the status bar (bottom right) in the Outlook
window? I've seen some timing oddities when cached mode is used and it
seems worse when drizzle mode or headers first are being used. The
full Outlook item is taking a while to download and have all its
properties populated and code is trying to access things before they
are fully there.

If you are using cached mode does it get any better if you disable
cached mode or force a full download of items before you access them
in code?
 
T

Tom Trulley

No, I don't use cached mode.

I think that an appointment that is an element of a series is not a
real object. If you try to access a property that is not defined for
that element Outlook switches to the parent element (the real
appointment with the start date). Could this be?


Ken Slovak - said:
Hmm, are you using cached Exchange mode? If so what does the
connection show in the status bar (bottom right) in the Outlook
window? I've seen some timing oddities when cached mode is used and it
seems worse when drizzle mode or headers first are being used. The
full Outlook item is taking a while to download and have all its
properties populated and code is trying to access things before they
are fully there.

If you are using cached mode does it get any better if you disable
cached mode or force a full download of items before you access them
in code?




Tom Trulley said:
This is how I get the items

Dim items
Set items = myFolder.Items
items.Sort "[Start]"
items.IncludeRecurrences = True
Dim strFind
strFind = "[Start] <= """ & FormatDateTime(currentDate, vbShortDate)
& " 11:59 PM""" & " AND [End] > """ & FormatDateTime(currentDate,
vbShortDate) & " 12:00 AM"""
Dim myAppts
Set myAppts = items.Restrict(strFind)
For Each AppointmentItem in myAppts
[...]

I'm using Outlook 2003 with Exchange Server 2003
 
K

Ken Slovak - [MVP - Outlook]

No, I don't think so. You might be getting the master appointment
though unless you get the RecurrencePattern and use GetObject to get
the occurrence. For appointments that are recurring what I've usually
found is that the only valid item unless I use GetOccurrence or the
Parent property of the RecurrencePattern to get the master.

Another possibility is that for some reason the item and all its
properties haven't yet been downloaded into Outlook 2003. I had some
problems like that in some installations that had been running Outlook
2003 beta, and on some mailboxes that had been touched by both Outlook
2000 and Outlook 2003. I ended up deleting the old mailboxes and
creating new ones.

Out of curiousity, I'd be interested in seeing if items where you are
getting this problem have a DownloadState of olFullItem or
olHeaderOnly. If olHeaderOnly you can set MarkForDownload to
olMarkedForDownload and loop until DownloadState = olFullItem. I
wonder if that would make any difference in your results.
 

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