Reading the contents of Outlook attachments in an Outlook add-in (C #) when creating mail

I am trying to develop an add-in add-in in VS 2010. The goal is to check the email content and attachment content for some keywords, and if such words are found, sending email should be blocked. I can read the body and subject of the email and check, but I do not understand how to read the contents of the attachment (txt file) when composing mail.

attachment.GetTemporaryPath () does not indicate an attachment path. I think this only works for emails in the inbox. One of the ways I found is to save the attachment to a temporary folder and read it (attachment.saveAs ()). Is this the only way to read the contents of attachments when composing mail?

Possible duplicate: C # Outlook 2007 - How to access the contents of attachments directly from my upload?

But, as suggested there, I cannot use the Atonement. Is there another way?

+4
source share
1 answer

Yes, saving attachment data to a temporary file and reading it in the only way. In theory, you can use Attachment.PropertyAccessor.GetProperty to read the PR_ATTACH_DATA_BIN property, but you will have problems with large (> 64 KB) files.

MAPI IStream (IAttach:: OpenProperty (PR_ATTACH_DATA_BIN, IID_IStream)), ++ Delphi. Redemption ( ), Extended MAPI AsArray AsText RDOAttachment Attachment , Safe * Item.

+4

Source: https://habr.com/ru/post/1569790/


All Articles