How best to handle Outlook.ItemsEvents_Event.ItemRemove ??

  • Thread starter Thread starter DaveG
  • Start date Start date
D

DaveG

I'm programming a COM Add-in using C#. I'm puzzling over the best way to
process "remove" events for the Items collection of a MAPIfolder. I've set
up an event handler for the event. Things work fine for Add and Change
events since the added or changed item is passed to the event handler.
There is no information passed to the event handler for a Remove event.
Does anyone know of a way to discover what Item was removed, or from what
folder?

Thanks!
Dave G.
 
No good ways.

You get the remove event but it doesn't have any information about the item
that was removed either by deletion or moving it to another folder. For
deletions you could catch ItemAdd in the Deleted Items folder but that won't
fire if the user hard deletes an item (Shift+Delete) or the item is hard
deleted using code. You could maintain a list of items in the folder,
perhaps in a collection or dictionary object and see which item is missing.

The BeforeDelete event does provide the information you need but it only
works if the user opens the item and deletes it from the File menu. So it's
not very useful.

That's about it.
 
Back
Top