none
Calendar ItemRemove gets fired on opening the Appointment Item (only for FIRST item opened) RRS feed

  • Question

  • Hi,

    I have written some code in Calendar.ItemRemove event handler.

    When I first open Outlook and open an Appointment Item, the ItemRemove gets fired for this item.

    This does not occurs for subsequent Appointment items Opened.

    Outlook.Items items = Globals.ThisAddIn.Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar).Items;
    //Hook item Remove
    items.ItemRemove += new Microsoft.Office.Interop.Outlook.ItemsEvents_ItemRemoveEventHandler(Items_ItemRemove);
    //Event handler
    void Items_ItemRemove()
    {
        System.Diagnostics.Debug.WriteLine("Items_ItemRemove");
    }

    Why is this happening?

    Any help appreciated.

    Thanks

    Tuesday, November 6, 2012 9:44 AM

Answers

  • outlook is free to reorganize appointments as it sees fit. This also means deleting appointments (especially recurring ones that have exceptions) and creating them anew. You will have to write code in such way that will take this into account.
    • Marked as answer by ank_s Wednesday, November 7, 2012 7:47 AM
    Tuesday, November 6, 2012 11:18 AM

All replies

  • outlook is free to reorganize appointments as it sees fit. This also means deleting appointments (especially recurring ones that have exceptions) and creating them anew. You will have to write code in such way that will take this into account.
    • Marked as answer by ank_s Wednesday, November 7, 2012 7:47 AM
    Tuesday, November 6, 2012 11:18 AM
  • Alos keep in mind that when an appointment update is received, Outlook deletes the existing appointment and creates a new one with the same appointment id (which is different from the entry id).

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.4 is now available!

    Tuesday, November 6, 2012 2:41 PM