【问题标题】:Export an EmailMessage from EWS that can be opened in MS Outlook从 EWS 导出可以在 MS Outlook 中打开的 EmailMessage
【发布时间】:2011-11-22 20:17:15
【问题描述】:

我正在编写一个使用 EWS 监控 Exchange 邮箱的应用程序。它将传入邮件的附件保存到网络文件夹中。

这些文件随后被 3d 派对应用程序使用。

现在有人问我是否可以不仅保存附件,还保存包含附件的整个电子邮件,以便在 Outlook 中打开它。 (不需要支持其他邮件客户端)。

Exchange 服务器是Exchange 2010,应用程序正在使用C# 编写 这可以使用 EWS 完成吗?还是我使用 Interop.Outlook 创建 .msg 文件的唯一解决方案?

【问题讨论】:

标签: c# exchangewebservices exchange-server-2010


【解决方案1】:

您使用的是哪个 Outlook 版本? Outlook 2010 可以打开 .EML 文件,这是邮件的“本机”存储格式 (RFC 2822)。在这种情况下,您可以使用 EWS Web 服务(或 EWS 托管 API)下载 MIME 内容。

在任何其他情况下,请查看 Outlook Redemption (http://www.dimastr.com/redemption/)。它可以将项目保存为 .msg 文件,并且可以从 C# 中使用。

【讨论】:

  • 大多数人都在使用 Outlook 2007(包括我自己),但他们将在不久的将来推出 Outlook 2010。感谢您的提示!
  • 我已经对此进行了测试,我们将提前为少数人推出 Outlook 2010。这将完美无缺,谢谢!
  • 我们很幸运使用 Mailbee .NET Converter (afterlogic.com/mailbee-net/outlook-converter) 将 EML 转换为 MSG。
【解决方案2】:
ExchangeService exchangeService = ...
EmailMessage mailMessage = ...

var propertySet = new PropertySet(BasePropertySet.FirstClassProperties, ItemSchema.MimeContent, EmailMessageSchema.IsRead);

exchangeService.LoadPropertiesForItems(mailMessage, propertySet);

File.WriteBytes("filename.eml", mailMessage.MimeContent.Content);

【讨论】:

  • 感谢您的评论,我知道我可以导出 *.eml,但我觉得 Outlook 无法正确读取文件,另请参阅我对 Henning Krause 的回答的 cmets。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-10-08
  • 1970-01-01
  • 2019-06-24
  • 1970-01-01
  • 2019-12-06
  • 1970-01-01
相关资源
最近更新 更多