Unable to retrieve recurring item using GetOccurrence method

A

achester

I need to programmatically delete a particular occurrence in a
recurring pattern of appointments or tasks in an Outlook 2003 calendar.


I have been using GetOccurrence to try to instantiate the occurrence,
but I just cannot make it work.

Example code:

Set olTask = gOlNameSpace.GetItemFromID(strEntryID, strStoreID)
....
Set olRecurrence = olTask.GetRecurrencePattern
itemDate=#2/5/2006#
Set olItem = olRecurrence.GetOccurrence(itemDate)
olItem.Delete

I get the recurrence pattern absolutely fine but when I use the
GetOccurrence method I always get an automation error:

-2147467259 "You changed one of the recurrences of this item, and
this instance no longer exists, Close any open items and try again"

I have tried many different ways of doing this, on patterns created
programmatically and on patterns created manually in the Outlook
client.

The instances do exist because they can be viewed in the Outlook client
window.

The error occurs whenever a correctly formatted date is submitted to
GetOccurrence, whether or not an occurrence should exist for that date.


Have I missed something or is there a problem with this method?

Andrew Chester
 
M

Michael Bauer [MVP - Outlook]

Andrew, you must pass the date and time.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.VBOffice.net --


Am 29 Nov 2006 09:26:54 -0800 schrieb (e-mail address removed):
 

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