Converting Outlook MSG to HTML in C# for Enhanced Readability

Converting Outlook MSG to HTML in C# for Enhanced Readability.

References or DLL Required

OFFICE.DLL and Microsoft.Office.Interop.Outlook.dll will be accessible through NuGet packages.

Create a Console application in Visual Studio.

Sample Code


Microsoft.Office.Interop.Outlook.Application app = new Microsoft.Office.Interop.Outlook.Application();

var item = app.Session.OpenSharedItem("C:\\Sample.msg") as Microsoft.Office.Interop.Outlook.MailItem;
string body = item.HTMLBody;
int att = item.Attachments.Count;

That's all, Let see the output.

Output

Thanks


Similar Articles