appointment 'Write' event not firing as expected

J

JohnV@nn

I have a vsto add-in with event handlers on Close and Write. I'm not
getting the Write event when I create an appointment, press escape,
get the prompt "do you want to save changes", answer 'Yes'. I get the
Close event, but not Write. Here is the behavior I'm seeing:

Create appointment, click Save&Close: 'Write' fires, 'Close' fires
Create appointment, press escape, answer 'No': 'Close' fires
Create appointment, press escape, answer 'Yes': 'Close' fires

Note that when I close & save the appointment by pressing escape and
answering 'Yes', the appointment is properly saved in the calendar; I
just don't get the write event. Is this a known issue; can anyone
else confirm that you get the same behavior?

Thanks,
John
 
K

Ken Slovak - [MVP - Outlook]

It's a known issue and it makes sense. Write fires before Close. If you use
Escape you're closing the item and not saving it. The fact that something
was changed causes the prompt and your answer there is after Write would
have fired. Just check for Saved. If you want more precision handle
PropertyChange and CustomPropertyChange to see what was changed and you can
save that information or just set a boolean dirty flag.
 

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