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


Guest


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: 18791
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 - http://social.msdn.microsoft.com/Forums/office/en-US/65c4e4da-c70b-4a55-8d07-0e23c6b812e9/problem-with-attachment-remove-event. In particular they refer to the description of the event at http://msdn.microsoft.com/en-us/library/ff863737.aspx - "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.


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