![]() |
Unable to retrieve recurring item using GetOccurrence method
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 |
Unable to retrieve recurring item using GetOccurrence method
Thank you Michael - this worked!
Michael Bauer [MVP - Outlook] wrote: 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 : 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 |
All times are GMT +1. The time now is 05:04 PM. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com