How to catch email deletion on the main inbox explorer?

101 views Asked by At

I'm having problems catching the deletion event for emails that are deleted on the inbox explorer. None of the events I've tried catch this. MailItem.BeforeDelete only triggers if the email is deleted using the inspectors delete button, which is fine but it only catches a portion of deletions. Explorer.BeforeItemCut only triggers when the user uses Ctrl+X. Explorer.BeforeMove doesn't trigger either, I thought that may "deletion" was really just moving the email to the Deleted Items folder.

I thought of maybe catching when an email arrives in the Deleted Items folder, but MAPIFolder items don't seem to have events. So, I'm not sure where else to look.

Just to make sure, by deleting an email I mean when the user hits the red X below. enter image description here

1

There are 1 answers

0
Dmitry Streblechenko On BEST ANSWER

You can catch the Items.ItemAdd event on the Deleted Items folder's Items collection.

It will not of course fire in case of Shift+Delete.