Consider the following scenario:
Sombody shared a calendar with me. I have full access to this calendar. When i delete an Item in the calendar the Folder.BeforeItemMove
Event is fired. So far so good.
I want to Track deletion by check wether the MoveTo Entry id is null
or the Entry id of the Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderDeletedItems)
which works.
Now back to the case where the item is in a shared folder:
null
Any Ideas?
(Tested in Outlook 2016)
If you have access to the Calendar as a Shared Calendar (e.g. Sent as EMail invitation to you via the OWA) deleted Items go to YOUR deleted items Folder. This you can get via
Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderDeletedItems)
If the Calendar is in a second mailbox in your profile the deleted item go to the deleted items folder of THAT account which you can acces via
Outlook.Store _Store = MoveTo.Store;
Outlook.Folder _Folder = MoveTo.GetDefaultFolder (OlDefaultFolders.olFolderDeletedItems) as Outlook.Folder;
You can differntiate these two scenarios by Checking if the Folder.Store
is null (which it is in the case of an Shared non mailbox calendar)