我相信读取 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 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!