A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Unable to retrieve recurring item using GetOccurrence method



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old November 29th 06, 06:26 PM posted to microsoft.public.outlook.program_vba
[email protected]
external usenet poster
 
Posts: 2
Default 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

Ads
  #2  
Old November 30th 06, 07:14 AM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default Unable to retrieve recurring item using GetOccurrence method



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

  #3  
Old November 30th 06, 10:32 AM posted to microsoft.public.outlook.program_vba
[email protected]
external usenet poster
 
Posts: 2
Default 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


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook 2003 recurring meeting, recurring item tab not opening [email protected] Outlook - Calandaring 0 November 21st 06 06:18 PM
Recurring item based on another recurring item Bill Bradley Outlook - Calandaring 0 November 15th 06 12:33 AM
How to change an item from a recurring Appointment item to an exception from VB code? Dikbill Outlook and VBA 2 July 13th 06 09:45 AM
Saving exception item in recurring appointment item fails Dikbill Outlook and VBA 2 July 11th 06 04:59 PM
Saving exception item in recurring appointment item fails Dikbill Outlook - Calandaring 0 July 11th 06 03:01 PM


All times are GMT +1. The time now is 01:06 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-2025 Outlook Banter.
The comments are property of their posters.