Loading, Viewing and Parsing MSG file

This topic explains how to load a Microsoft Outlook Message file (*.msg). The MapiMessage class is used to load MSG files and provides several static loading functions for different scenarios. The following code snippet shows you how to load MSG files from file or from stream.

Loading MSG Files

The following code snippet shows you how to load MSG files.

Loading from Stream

The following code snippet shows you how to load file from stream.

Converting EML to MSG preserving embedded EML format

EML files can be loaded into MapiMessage class by instantiating a MailMessage object and passing it to MapiMessage.FromMailMessage method. If the EML file contains embedded EML files, use MapiConversionOptions.PreserveEmbeddedMessageFormat to retain the format of embedded EML files. The below code snippet shows how to load EML files into MapiMessage while preserving the format of embedded EML files.