0

Is there a way to create a MailMessage object from a directory path of a .msg file?

Such as MailMessage x = new MailMessage("path")

Austin
  • 1
  • 1

2 Answers2

0

There is no direct conversion between these two entities out of the box - the Outlook message file and the MailMessage class from the .net framework. You can automate Outlook to get the instance of the MSG file instantiated using the NameSpace.OpenSharedItem method which is used to open iCalendar appointment (.ics) files, vCard (.vcf) files, and Outlook message (.msg) files.

You can also use Redemption for that, look for RDOSession.GetMessageFromMsgFile.

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45
0

Thanks for the replies but I found the answer on this existing post: C# Outlook interop and OpenSharedItem for opening MSG files

Like Eugene said, I used the Microsoft.Office.Interop.Outlook.Application to open the .msg file via Outlook.

Austin
  • 1
  • 1