Access content of attachment in ProcessAttachmentRemove event

Add-in Express™ Support Service
That's what is more important than anything else

Access content of attachment in ProcessAttachmentRemove event
Willy Wu

Posts: 5
Joined: 2013-10-09
Hi Add-in Express Team,

We develop an add-in need to read content of attachment when user delete it.
So I use the ProcessAttachmentRemove event handler to access removed attachment.
I have try the following method to get content of attachment, but all is not work.

1. Use MAPIObject property of attachemnt object. (It occurs exception.)
2. Call SaveAsFile of attachemnt object to save a temp file, and read it. (It occurs exception while calling SaveAsFile method)
3. From MailItem of this removed attachment to access this attachment object. (This removed attachment do not exist, is has been removed)

Do you have any idea how to read attachment in ProcessAttachmentRemove event?
Many thanks.
Posted 25 Feb, 2014 20:57:54 Top
Andrei Smolin

Add-in Express team

Posts: 16992
Joined: 2006-05-11
Hello Willy,

When calling Attachment.SaveAsFile in the AttachmentRemove event (it is mapped to the ProcessAttachmentRemove mehtod in Add-in Express) I get this exception:

Cannot save the attachment. Outlook cannot perform this action on this type of attachment.

Please have a look at this thread - In particular they refer to the description of the event at - "Occurs when an attachment has been removed from an instance of the parent object." It looks like this is a wrong event for your task. Or, you probably need to gather the required info about attachments before this event is fired.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 26 Feb, 2014 05:38:47 Top