Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Read Outlook .msg File

Tags:

c#

com

outlook

I believe that the only way to read an Outlook .msg file (in order to extra metadata like subject, attachments etc), is to use the Outlook API - the Application.Session.OpenSharedItem() method.

If this is the case, then I am looking for way to run this code on our application server, which doesn't have MS OFfice or MS Outlook installed. I'm getting the error

System.ArgumentException: progId not found. Outlook.Application

Which of course is due to the absence of the Outlook application.

Is there any way to install just a DLL or something in order to get the OpenSharedItem method to work? I don't want to have to install the full client if possible.

Or, is there a way to parse a .msg file without requiring significant dependencies such as Outlook?

like image 705
Simon Green Avatar asked Oct 29 '14 14:10

Simon Green


1 Answers

This was answered in a codeplex article I have saved from a long time ago

Article is here, there is a file called OutlookStorage.cs that does not require the outlook model.

As in the comments below there is now a nuget package that covers this:

here

Props to Simon Green in the comments for this.

like image 178
krystan honour Avatar answered Oct 11 '22 16:10

krystan honour