///<Summary> /// Get Mapi Message From File ///</Summary> /// <param name="fileNamePath"></param> public static Aspose.Email.Mapi.MapiMessage GetMapiMessageFromFile(string fileNamePath) { var formatInfo = Email.Tools.FileFormatUtil.DetectFileFormat(fileNamePath); switch (formatInfo.FileFormatType) { case Email.FileFormatType.Msg: return(MapiMessage.Load(fileNamePath, new Email.MsgLoadOptions())); case Email.FileFormatType.Eml: return(MapiMessage.Load(fileNamePath, new Email.EmlLoadOptions())); case Email.FileFormatType.Mht: return(MapiMessage.Load(fileNamePath, new Email.MhtmlLoadOptions())); case Email.FileFormatType.Tnef: return(MapiMessage.Load(fileNamePath, new Email.TnefLoadOptions())); default: return(null); } }