Joe Acunzo
Posts: 13
Joined: 2012-01-03
|
When I drag and drop an occurrence of a recurring AppointmentItem, or make any change by opening one occurrence, Outlook triggers the ItemChange event as I would expect. However, it passes to the event the master AppointmentItem instead of the occurrence. Why would that be? I thought it might be because the Exception list is changing, but at the time of the event, the list is empty still. I never get an ItemChange on the occurence.
I need to know the occurrence changed. How can I detect that? |
|
Andrei Smolin
Add-in Express team
Posts: 18793
Joined: 2006-05-11
|
Hello Joe,
Make sure all other COM add-ins are turned off. Also, your own add-in may not release the COM object representing the appointment item and this may spoil the things.
I suppose you test your add-in on an Outlook connected to Exchange [Online]. If so, at https://social.msdn.microsoft.com/Forums/aspnet/en-US/901d03a3-8e9b-4d27-8c91-76f876ec38fe/outlook-2016-produces-an-extra-itemchange-event-after-an-appointment-is-created?forum=outlookdev, Dmitry Streblechenko, a recognized Outlook and Extended MAPI guru responded to my question with this comment (I've corrected a mistype): "Exchange likes to update appointments quite often, especially immediately after they were created".
On my machine, simple VBA handlers of the ItemAdd and ItemChange events print the following; Type=1 means OlRecurrenceState.olApptMaster; pay attention to my actions and time stamps.
{create}
3/20/2019 4:14:12 PM itms_ItemAdd, Exceptions.Count=0 Type=1
{do nothing}
3/20/2019 4:14:16 PM itms_ItemChange, Exceptions.Count=0 Type=1
{drag an occurence}
3/20/2019 4:14:49 PM itms_ItemChange, Exceptions.Count=1 Type=1
{select another date at some moment and wait}
3/20/2019 4:15:07 PM itms_ItemChange, Exceptions.Count=1 Type=1
{drag an occurence}
3/20/2019 4:15:17 PM itms_ItemChange, Exceptions.Count=2 Type=1
{select another date at some moment and wait}
3/20/2019 4:15:35 PM itms_ItemChange, Exceptions.Count=2 Type=1
Andrei Smolin
Add-in Express Team Leader |
|
Joe Acunzo
Posts: 13
Joined: 2012-01-03
|
Andrei, thank you for your reply.
After creating a recurring appointment, I restarted Outlook to ensure no referrences are being held to it, so that's not the issue here.
Your test shows the same problem I'm experiencing. That is, there is no ItemChange on the occurrence when you dragged it, only an ItemChange on the master (Type=1). I would have expected Outlook to fire an ItemChange on the occurrence. Can you think of a method to determine an occurrence has changed, without having to track before and after values by looking at the Exceptions?
Also thank you for the link to the post about Exchange updating appointments, good to know. I'll have to startup my test Exchange VM, and try things out with that. |
|
Andrei Smolin
Add-in Express team
Posts: 18793
Joined: 2006-05-11
|
Joe Acunzo writes:
Can you think of a method to determine an occurrence has changed, without having to track before and after values by looking at the Exceptions?
Outlook doesn't store occurrences. Instead, it stores the master appointment that keeps the occurrence pattern and exceptions.
Andrei Smolin
Add-in Express Team Leader |
|