Home > Blockchain >  How to access a large attachment BeforeAttachmentWriteToTempFile In Outlook AddIn
How to access a large attachment BeforeAttachmentWriteToTempFile In Outlook AddIn

Time:05-21

I'm trying to intercept an attachment being added to a message in an Outlook plugin. Outlook/Exchange settings blocking large attachments, and I have found that when using the Attach button or dragging and dropping files to attach the "BeforeAttachmentWriteToTempFile" event fires BEFORE the message is displayed. This is great, it allows you to Cancel attach process before the message is display.

However the problem is the Attachment Object passed to this Event throws COM exceptions when trying to get the FilePath or GetTemporaryFilePath. It also has a null DisplayName and 0 Size. I'd like to be able to access the filePath of the item that was attempted to attached

Error I'm getting

CodePudding user response:

Use the MailItem.BeforeAttachmentAdd event instead. It is fired before an attachment is added to an Outlook item.

CodePudding user response:

You can instead try to bypass the large attachment limitation to avoid Outlook prompt, and deal with the large attachment only after it can be accessed/modified. See Bypass/Ignore Exchange Server "Maximum Send Size"?

  • Related