none
Capturing AppointmentItem events in a shared calendar RRS feed

  • Question

  • I've created a wrapper class (created at class level) to wrap the AppointmentItem object.

    The events are captured and processed nicely as long as it's in MY calendar.  However, when the AppointmentItem is in a Shared Calendar, the only events I've seen fire so far are "AfterWrite", "PropertyChange" and "Write".  "BeforeDelete" is never fired even though I've tried deleting the event several ways.

    I decided to create a Wrapper for the Shared Calendar itself and maintain a Dictionary of AppointmentItems in the shared calendar class (again, declared at class level)

    When the other user is logged into Outlook, None of the AppointmentItems in their calendar fire events; even though the Shared Calendar events (folder events) fire consistently.

    When the user is NOT logged into Outlook ALL AppointmentItem events fire perfectly.  There are no problems whatsoever in this last scenario.

    So, what's happening "under the hood"?  

    Friday, June 20, 2014 6:24 PM

Answers

  • After some time it looks like my problems go deeper.   I'm not utilizing ReleaseCOMObject (or other similar code).  I was under the assumption that an Object going out of scope would simply take care of itself.

    The following article gives a great explanation on several of the issues I'm experiencing including events not firing when expected:

    http://badecho.com/2010/08/outlook-com-interop-and-reference-counting-or-how-i-learned-to-stop-worrying-and-love-the-rcw/

    Friday, June 27, 2014 10:29 AM

All replies

  • Hello,

    Do you use the cached Exchange connection mode in Outlook?

    The BeforeDelete event description in MSDN contains the following:

    In order for this event to fire when an e-mail message, distribution list, journal entry, task, contact, or post  are deleted through an action, an inspector must be open.

    Is this the case?

    Friday, June 20, 2014 6:43 PM
  • It requires an Inspector window be Open?  Very Interesting.

    I don't know about "cached" Exchange connection Mode.  I'll look it up and find out.


    Friday, June 20, 2014 7:56 PM
  • > It requires an Inspector window be Open?  Very Interesting.

    Please let me know whether that is the case.

    Friday, June 20, 2014 8:11 PM
  • We do use "Cached Exchange" Mode

    I'm still looking into the inspector.  

    Friday, June 20, 2014 9:07 PM
  • I found some code that creates an Inspector wrapper.  It's a factory class that acts as a base class for AppointmentItems, MailItems, TaskItems, JornalItems, and PostItems.

    They all take an Inspector as a parameter.  

    Looking more into this.

    Friday, June 20, 2014 9:27 PM
  • When you read the documentation carefully, it does not specifically refer to the AppointmentItem.BeforeDelete event. 

    Without making any specific reference to an inspector object in my code (I don't attempt to retrieve and reference it),  BeforeDelete fires for the AppointmentItem in the Shared Calendar as long as that user is not running Outlook.

    However, there is one thing I do need to test.  I need to differentiate between Outlook not running on their machine and a copy of my Add-In simply not being loaded.  this is something I'll need to test.

    The folder events are firing just fine in the Shared Calendars (ItemAdd, ItemRemove, ItemChange).

    Monday, June 23, 2014 2:35 AM
  • After some time it looks like my problems go deeper.   I'm not utilizing ReleaseCOMObject (or other similar code).  I was under the assumption that an Object going out of scope would simply take care of itself.

    The following article gives a great explanation on several of the issues I'm experiencing including events not firing when expected:

    http://badecho.com/2010/08/outlook-com-interop-and-reference-counting-or-how-i-learned-to-stop-worrying-and-love-the-rcw/

    Friday, June 27, 2014 10:29 AM
  • I've cleaned up the memory Issues.  Here's what I'm finding.

    WHEN THE ITEM IS IN MY CALENDAR
    Item_Write:
    - fires when I right click on the AppointmentItem and select an Item from "Show As" context menu
    - fires when I right click on the AppointmentItem and select an Item from the "Categories" context menu
    - fires when  I click and Drag the appointmentItem to a new time

    Item_BeforeDelete
    - fires when I right click on the AppointmentItem and select delete.

    In all cases, no inspector window was opened

    WHEN THE ITEMS ARE IN THE SHARED CALENDAR

    Item_Write: 
    - fires when I right click on the AppointmentItem and select an Item from "Show As" context menu
    - fires when I right click on the AppointmentItem and select an Item from the "Categories" context menu
    - Does NOT fire if I click and Drag the appointmentItem to a new time.  I have to open an Inspector Window to change the time. 

    Item_BeforeDelete

    - Only fires when an Inspector Window is open in the Shared Calendar.

    Saturday, June 28, 2014 11:06 AM