none
Outlook VSTO Add-in Drag and Drop of Appointment between Calendars works fine in Window 10 but not Windows 7 / 8 RRS feed

  • Question

  • I have a C# VSTO Outlook 2013 Add-In

    The add-in intercepts and handles a user dragging and dropping an Appointment BETWEEN calendars

    * Outlook default behavour is to COPY an Appointment and I need to prevent that happening

    The add-in had been installed on Windows 10 PCs running OL2013 and OL2010 and works fine

    Recently we installed on a Windows 7 PC and some  Windows 8 PCs running OL 2010

    * On these PCs the add-in throws an exception - see below for where in the code this occurs

    THE QUESTION IS - why is this happening?

    In my code I intercept and cancel the BeforePaste event In the event  handler I

    * copy the Appointment to the target calendar (OL gives it a new EntryId)

    * locate the original appointment (using its EntryID) and delete it

    outlook.Session.GetItemFromID(entryId) as Outlook.AppointmentItem).Delete();

    The exception is thrown on the above code line is "“Object Reference not set to instance of an object”

    Presumably Outlook  fails to find the Appointment from the EntityID




    Monday, January 29, 2018 11:58 AM

All replies

  • Hello AndrewBinghamTBSPCL,

    Is BeforePaste event Explorer.BeforePaste event? Could you please share us whole code in the event and your repro steps so we could try to reproduce your issue.

    Thanks for understanding,

    Best Regards,

    Terry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, January 30, 2018 3:20 AM
  • Hi Terry

    I was able to investigate further by remoting onto a PC last night

    The issue appears to be this:

    * using my PC (not using Microsoft Exchange Server, MES) the method GetItemFromID() finds the Item

    * on remote PC (using Microsoft Exchange Server) the method fails and code throws an exception (attempts to delete the Item - which is null)

    * On my PC the EntryId of the original Item AND the item in the Deleted Folder are the same

    * I cannot check the EntryId on the remote PC

    It looks to me like Outlook using MSE - either the EntryId IS changed when the item is moved to the Deleted Folder AND/OR the StoreId of the Deleted Folder is needed

    I modified the code to use the StoreId of the Deleted folder, obtained using

    outlook.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderDeletedItems);

    The code is OK on my (non-MSE) PC

    The code fails on the remote (using MSE) PC

    The issue seems to be with the EntryId or the StoreId  when Outlook uses MSE

    Or more fundamentally - How to Delete an item from the Deleted Folder in Outlook using MSE

    Tuesday, January 30, 2018 8:04 AM