用C# Outlook interop和OpenSharedItem打开MSG文件 [关闭]。

问题描述 投票:3回答:2

是否有任何教程或资源可以遵循,以便使用OpenSharedItem outlook interop方法。我的目标是使用它来读取MSG文件(因为它可以让你的文件更容易被读取)。显然 这样做)。)

c# interop outlook office-interop msg
2个回答

25
投票

谢谢Svetlozar,我已经用这些资源创建了类似下面的东西。

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;

也许对其他想快速入门的人有用,就像我一样。

© www.soinside.com 2019 - 2024. All rights reserved.