appointment 'Write' event not firing as expected

  • Thread starter Thread starter JohnV@nn
  • Start date Start date
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
 
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.
 
Back
Top