I am using Microsoft.Office.Interop.Outlook
in C# to access a mailbox and find messages with specific file attachments. I need to interact with the attachments.
Currently, I am saving the file to a new location and accessing it from there. This copying process is slowing me down. I'd ideally like to access the file from wherever it is being stored in memory, but the Outlook.Attachment.PathName
field is returning null.
The messages are being stored on an Exchange server.
Is it possible to access them directly or do I need to continue saving the files?
You can open an attachment from the Reading Pane or from an open message. In either case, double-click the attachment to open it. To open an attachment from the message list, right-click the message that has the attachment, click View Attachments, and then click the name of the attachment.
Many e-mail programs (e.g., Microsoft Outlook, or Thunderbird), use a dedicated folder for storing message attachments. This folder may be located in C:\Users\<yourUserName>\. The folder is a temporary storage location, meaning that the files may be removed by the program at any time.
Outlook.Attachment.PathName
implies a disk location. The attachment is a file; if you want to interact with it, you have to treat it like a file, and that means saving it out to the local disk.
The Outlook.Attachment
object does not actually contain the attached file; it contains a link to the attached file, with some associated metadata.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With