简体   繁体   中英

avoid deleting attachments in outlook using addin programming

I wonder if there is any way to avoid deleting attachments in outlook mailItem using code either with right clicking and select remove or delete by pressing delete key.

I didn't find any solution like [beforeAttachment] event for it.

Removing attachments is only committed if the MailItem is then saved. Therefore one thing you could do is add an event handler for the AttachmentRemove event , and set a flag if the event fires. Armed with the knowledge that an attachment has been removed, you could then deny attempts to save the MailItem, by cancelling the Write event or by whatever means works best with your code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM