Is there any tutorial or resource I can follow in order to use the OpenSharedItem outlook interop method. My goal is to read MSG files using it (as it can apparently do so).
Asked
Active
Viewed 1.6k times
2 Answers
25
Thanks Svetlozar, I've used the resources to create something like the following:
Microsoft.Office.Interop.Outlook.Application app = new Microsoft.Office.Interop.Outlook.Application();
var item = app.Session.OpenSharedItem("C:\\test.msg") as Microsoft.Office.Interop.Outlook.MailItem;
string body = item.HTMLBody;
int att = item.Attachments.Count;
It may be useful to others looking for a quickstart as I was.

Nikolaos
- 1,449
- 2
- 15
- 19
-
3Also possibly useful to others: Remember to call Marshal.ReleaseCOMObject(item); once you're done with item; this will ensure the file does not remain locked by Outlook. – M Kloster Jul 24 '19 at 13:10