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?
Outlook.Attachment.PathNameimplies 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.Attachmentobject does not actually contain the attached file; it contains a link to the attached file, with some associated metadata.