Get sub messages from Outlook .msg files

痴心易碎 提交于 2020-01-06 05:26:10

问题


I need to parse a few .msg files which have trail mails. Is there any way to get the sub messages and identify the initiated and the responded emails. I do not want to use any third party tools. I am allowed to use the Outlook interop. Below is the code that I have used to read the msg file.I am able to get the Body ,HTMLBody and other details.But I actually need all the trailing messages.

    outlook._Application app = null;
    outlook.MailItem item = null;
    outlook.NameSpace session = null;
    try
    {
        app = new outlook.Application();
        session = app.Session;
        item = session.OpenSharedItem(file) as outlook.MailItem;

    }
    catch(Exception ex)
    { }

回答1:


If you are limited to OOM only, the only way to do that is to save each embedded message attachment as an MSG file (Attachment.SaveAsFile), then open it using Namespace.OpenSharedItem.

If using Redemption is an option, an MSG file can be opened using RDOSession.GetMessageFromMsgFile (similar to Namespace.OpenSharedItem in OOM), and the embedded message attachment can be accessed using the RDOAttachment.EmbeddedMsg property (returns RDOMail object) - no need to save the attachment first.



来源:https://stackoverflow.com/questions/46180621/get-sub-messages-from-outlook-msg-files

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!