We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Saving attachment to disk from msg file


I want to read the msg file using following code.

: {
mapimessageclass p_asposeMailObj.=mapimessageclass.fromfile(msgpath) // mapimessageclass object
MapiAttachmentCollection attachments = p_asposeMailObj.Attachments;
foreach (MapiAttachment attachObj in attachments)
Attachment sysAttachObj = new Attachment();
FileName = attachObj.FileName;
DisplayName = attachObj.DisplayName;
AsArray = attachObj.BinaryData;

Now it saves the attachments in the attachsavepath but only able
to save first 3 attchment after that the attchment are saved but cant be open it shows file is corrupted.
we also observed that the byte array of attachment (attachObj.BinaryData) is not proper.

can you please tell us what it the exact issue.

Hi Amol,

Thanks for writing to us.

You are actually affected by the evaluation limitations of the product which arises due to absence of license. In order to test the completely functionality of Aspose.Email, you can get a 30-day temporary license free of cost. Please feel free to write to us if you have any additional query/inquiry related to Aspose.Email. We’ll be glad to assist you further.