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

Free Support Forum - aspose.com

Get Original File Name from embedded object


I am evaluating aspose.email v18.1. I am using MapiMessage class to parse the outlook message files.
I need your help to get the original file name if message file has embedded attachments.



Thank you for writing to Aspose support team.

You may please use following sample code to display embedded object original file name. If it does not display the required information, please send us the sample file for our testing here. We will analyze the sample file and provide assistance accordingly.

MapiMessage mapi = MapiMessage.FromFile(@"Test Subject.msg");
foreach(var att in mapi.Attachments)


Thanks for your response.

The above code works if message has regular attachments. I need to extract actual filename if attachment is inline.
When tested, for any outlook message with inline attachment for HTML and RTF body type, i was unable to extract it.

For inline attachment of HTML body type message file, attachment properties such as DisplayName, FileName and LongFileName will have filename image001.png.
For inline attachment of RTF body type message file, attachment properties are stored in ObjectData property.

For both cases, i was not able to get the actual file-name and extension.



Could you please send us a sample file for our analysis here? It will help us to observe the behavior and provide assistance accordingly.

SampleMSGFiles.zip (29.0 KB)
Please find the sample msg files and let me know your feedback.

It contains two message file with inline attachment test.txt file for RTF and HTML body type message files.
The message files are created using ms outlook 2007.



If you open the Message file with Html body using Outlook Spy or MFCMapi and analyze the message attachments, you will see that attachment names are the same as displayed by Aspose.Email API. For message with RTF body, when we try to open it in MS Outlook, it doesn’t display the attachment and blocks it. We are not sure if it is a valid message file or not as the latest version of MS Outlook has issues displaying it.


I am able to extract original filename of embedded/inline attachment after referring following two links:

But, failed to extract the same for following sample msg files. Could you please help?embedded_filename_not_extracted.zip (300.0 KB)



Thank you for providing sample messages. We have tested this issue and observed the problem. It is logged in our issue tacking system under Id:EMAILNET-38944 for detailed analysis. We will write back here as soon as analysis is completed and feedback is ready to share.

Any update on this issue?


This issue is logged too recently and is still in queue for analysis. We will write back here once this issue is analyzed and feedback is ready to share.

The issues you have found earlier (filed as EMAILNET-38944) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by kashif.iqbal

Hi Team,

I have a issue after downloading content along with embedded attachments to word document.

After getting attachments,I am getting attachment name as default ex:if it’s excel, I am seeing as Microsoft excel sheet as attachment name.but I need the attachment name as proper name that I have.

How to resolve this issue.In which version of Aspose-Words can i get?

I am using Aspose-words version 16.4.0

Could you please help on this

Thank you in advance


I have tried understanding your requirements and have not been able to completely understand them. First of all I suggest you to use latest Aspose.Email for .NET 20.1 and Aspose.Words for .NET 20.1 on your end. In case if your requirement is still not met then please share source files, working sample project, output obtained and output desired with us.