Sicos1977 / MSGReader

C# Outlook MSG file reader without the need for Outlook
http://sicos1977.github.io/MSGReader
MIT License
476 stars 168 forks source link

Getting byte array from Attachment of type EMBEDDED_MSG #353

Closed mathy-plutoflume closed 1 year ago

mathy-plutoflume commented 1 year ago

I am trying to processes a MSG file which has three attachments inside it. Something like,

test_message.msg
    ├── Attachment1.msg
    ├── Attachment2.eml
    ├── Attachment3.pdf

When i am trying to extract the attachments using Message.Attachments i am getting Attachment1.msg & Attachment2.eml of type Message and Attachment3.pdf as Attachment type. For Attachment3.pdf i can access the Bytes[] from Attachment.Data. Is there any way where i can get the Bytes[] for the Attachment1.msg and Attachment2.eml attachments?

Sicos1977 commented 1 year ago

You can use the Data property for that

        /// <summary>
        ///     Returns the data
        /// </summary>
        public byte[] Data => _data ?? GetMapiPropertyBytes(MapiTags.PR_ATTACH_DATA_BIN);