How to determine if MSG-file is Outlook-MSG-file?

Hello,


how can I determine if a MSG-file was saved from Outlook?

What I want to know:
How can I determine if I should load the MSG-file as MapiMessage or as MailMessage?

Hi,

Thank you for writing to Aspose Support team.

The API provides the FileFormatInfo class for detecting file format of the message. However, you can use both MapiMessage as well as MailMessage to load a MSG file as shown in the following code sample. Please let us know if we can be of any additional help to you in this regard.

MapiMessage msg = MapiMessage.FromFile(“Input.msg”);

MailMessage emlMsg = MailMessage.Load(“Input.msg”, new MsgLoadOptions());

Hi Peter,

are you sure you answered to the right question?

I wanted to know if there is a way to detect that a MSG file was created via Outlook using the MapiMessage or MailMessage API (C#).
Outlook MSG files sometimes need special “treatment” when converting to PDF…

If you have any ideas or input regarding that question I am still happy to hear about them.

Kind regards,
Bea

@bea.grosse-venhaus

You can load MSG file created by Outlook using MapiMessage. However, there is no APIs to detect either is it created via Outlook or not.

Could you please share some more detail about this special “treatment” by Outlook MSG file? We will then answer your query according to your requirements. Thanks for your cooperation.