【问题标题】:Retrieving RTF text from Microsoft EWS从 Microsoft EWS 检索 RTF 文本
【发布时间】:2014-06-12 03:59:57
【问题描述】:

是否可以使用 Exchange Web 服务获取 RTF 内容。

Ews 属性集只允许正文类型 HTML 或纯文本。

谢谢。

【问题讨论】:

  • 您是否尝试从现有消息中以 RTF 格式获取它?还是您正在创建新消息并希望将 RTF 内容放入新消息中?
  • @MimiGentz,我正在尝试获取现有消息。
  • 压缩 RTF 有一个扩展属性。我没有在 RTF 消息上对此进行测试,但我认为如果您在属性集中包含扩展属性定义,您应该能够检索该属性的内容。 ExtendedPropertyDefinition PidTagRtfCompressed = new ExtendedPropertyDefinition(0x1009, MapiPropertyType.Binary); PropertySet propSet = new PropertySet(BasePropertySet.IdOnly, EmailMessageSchema.Subject, PidTagRtfCompressed); EmailMessage message = EmailMessage.Bind(service, ItemId, propSet);
  • 你有机会尝试吗?
  • @MimiGentz - 是的。不幸的是它没有工作。var PidTagRtfCompressed = new ExtendedPropertyDefinition(0x1009, MapiPropertyType.Binary);var propertySet=new PropertySet(new PropertyDefinitionBase[] { ItemSchema.MimeContent, ItemSchema.Subject, PidTagRtfCompressed });message.Load(propertySet);将 mimecontent 保存到 eml,当我查看内容时,没有 RTF 内容。只有 HTML 和纯文本。尝试使用 Outlook 加载 eml,仍然显示 HTML。

标签: outlook rtf exchangewebservices


【解决方案1】:

您需要使用 PidTagRtfCompressed 属性来创建扩展属性定义,然后将扩展属性定义添加到您的属性集,然后使用该属性集获取项目。响应将包含 RTF 数据。

ExtendedPropertyDefinition PidTagRtfCompressed = new ExtendedPropertyDefinition(0x1009, MapiPropertyType.Binary);     
PropertySet propSet = new PropertySet(BasePropertySet.IdOnly, EmailMessageSchema.Subject, PidTagRtfCompressed);     
EmailMessage message = EmailMessage.Bind(service, ItemId, propSet);

【讨论】:

  • 咪咪,返回的字节数组究竟包含什么?我不确定如何从中获取实际的 RTF 文本。
  • 我已经很久没有使用这个了,但是字节数组包含 base-64 压缩的 RTF 正文。 MS-OXRTFCP 协议文档中定义了压缩和解压算法,这里有一个解压示例:msdn.microsoft.com/en-us/library/ee219303(v=exchg.80).aspx。你真的必须一点一点地破译它。
猜你喜欢
  • 2021-08-27
  • 2016-08-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-03-14
  • 1970-01-01
相关资源
最近更新 更多