【问题标题】:No response received when trying to get text body in ExtendedPropertyDefinition尝试在 ExtendedPropertyDefinition 中获取文本正文时未收到响应
【发布时间】:2017-03-06 07:59:36
【问题描述】:

我想接收纯文本格式的消息正文。 我正在使用以下代码,但是当我尝试通过扩展属性集合时,它什么也没提供。

extendedPropertyDefinition = new ExtendedPropertyDefinition(0X1000,
                MapiPropertyType.String);

propertySet = new PropertySet(PropertySet.FirstClassProperties.getBasePropertySet(),
                ItemSchema.MimeContent, extendedPropertyDefinition);

propertySet.setRequestedBodyType(BodyType.HTML);


emailMessage = EmailMessage.bind(service, itemId, propertySet);

【问题讨论】:

    标签: exchangewebservices extended-properties


    【解决方案1】:

    如果你想要纯正文,那么只需制作

    propertySet.setRequestedBodyType(BodyType.HTML);

    喜欢

    propertySet.setRequestedBodyType(BodyType.Text);

    您不能在同一个请求中同时请求两种主体类型 EWS 甚至只会将一种主体类型返回给您。如果您希望两者都在同一个请求中,您可以尝试将其从 MimeContent 中解析出来,但您是否会在此处获得两者将取决于消息的原始格式。很多时候,当请求文本正文时,Exchange 存储会从发送消息的任何本机格式进行即时转换。

    【讨论】:

    • 我想要 HTML 和纯文本内容。如果我尝试以下代码:- PR_HTML_BODY= new ExtendedPropertyDefinition(0X1013, MapiPropertyType.Binary); propertySet = new PropertySet(PropertySet.FirstClassProperties.getBasePropertySet(), ItemSchema.MimeContent, PR_HTML_BODY); propertySet.setRequestedBodyType(BodyType.Text);这将 html 作为 byte[] 提供,同时将此 byte[] 转换为 String 它会为特殊字符产生垃圾。反正有没有通过 ExtendedPropertyDefinition 获取纯文本
    • 您不能在同一个请求中请求两个消息正文(即使您使用扩展属性)由于我提到的原因它不起作用,您需要提出两个请求。在这种情况下,您不需要使用扩展属性,只需使用强类型属性,您就不会遇到问题,因为它会返回字符串。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-08-02
    • 2021-01-19
    • 2020-08-04
    • 2022-10-13
    • 1970-01-01
    • 1970-01-01
    • 2023-03-19
    相关资源
    最近更新 更多