读取 Outlook .msg 文件 [英] Read Outlook .msg File

查看:33
本文介绍了读取 Outlook .msg 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我认为读取 Outlook .msg 文件的唯一方法(为了获取主题、附件等额外元数据)是使用 Outlook API - Application.Session.OpenSharedItem() 方法.

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.

如果是这种情况,那么我正在寻找在我们的应用程序服务器上运行此代码的方法,该服务器没有安装 MS OFFice 或 MS Outlook.我收到错误

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

这当然是因为没有 Outlook 应用程序.

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

有什么办法可以只安装一个 DLL 或其他东西来让 OpenSharedItem 方法工作?如果可能,我不想安装完整的客户端.

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.

或者,有没有一种方法可以解析 .msg 文件而无需 Outlook 等重要依赖项?

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

推荐答案

这个问题在我很久以前保存的 codeplex 文章中得到了回答

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

文章在这里,有一个名为 OutlookStorage.cs 的文件不需要 Outlook 模型.

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

正如在下面的评论中,现在有一个 nuget 包涵盖了这一点:

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

这里

在评论中向 Simon Green 表示支持.

Props to Simon Green in the comments for this.

这篇关于读取 Outlook .msg 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆