Problem with recurring appointments

J

Jakob Olsen

Hi,


I am trying to copy appointments from Outlook2003 out to another program and
I am having trouble with recurring appointments.

I have this code, that is supposed to copy appointments i a specified period
of time:

Set objOlItems = objOlCaFolder.Items
objOlitems.IncludeRecurrences = True
objOlitems.Sort "[Start]"
objOlitems.Find "[Start] > 01-04-2005 AND [End] < 01-05-2005

For Each objOlItem In objOlitems
If objOlItem.Class = olAppointment Then
...do stuff
End If
Next

My problems are:
1) I have only found that the EntryID on the AppointmentItem is unique but
with recurring items they all have the same EntryID. Is there another
property I can use to disinguish between recurring appointments?
2) Eventhough I have set the Find-property all items that are recurring
return all recurrences as long as the master is between the two dates. This
is a big problem since some recurrences are indefinite and therefore becomes
a neverending loop.

Please help!


Y/Jakob
 
J

Jakob Olsen

Hi

I found out the second problem myself:
I changed the code to:

oItems.Sort "[Start]"
oItems.IncludeRecurrences = True
Set oItem = oItems.Find("[Start] > ""30-03-2005"" AND [End] <
""30-04-2005""")

Do
If oItem.Subject = "Test" Then
MsgBox oItem.Start & vbCrLf & oItem.EntryID
End If
Set oItem = oItems.FindNext
Loop Until oItem Is Nothing


But I still havn't found a solution to the first problem:
1) I have only found that the EntryID on the AppointmentItem is unique but
with recurring items they all have the same EntryID. Is there another
property I can use to disinguish between recurring appointments?


Y/Jakob
 
K

Ken Slovak - [MVP - Outlook]

There really is only one recurring appointment, the master one. Get that
from any instance of the recurring series by using GetRecurrencePattern.
Only use that however after checking IsRecurring or you'll end up converting
non-recurring appointments into recurring ones.

Use the RecurrencePattern object's GetOccurrence method to get a specific
instance of the series. Use the Exceptions collection to get any exceptions.
 

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