【问题标题】:How to query EWS for a Calendar Message Body如何在 EWS 中查询日历消息正文
【发布时间】:2016-07-08 10:24:41
【问题描述】:

我正在寻找比这个答案中给出的更多的细节:Exchange EWS not returning message body for calendar

具体来说,我不确定如何在查询中获取日历消息的正文。

我的 XML 查询是:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Body>
        <m:FindItem Traversal="Shallow" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
            <m:ItemShape>
                <t:BaseShape>IdOnly</t:BaseShape>
                <t:AdditionalProperties>
                    <t:FieldURI FieldURI="item:Body"/>
                    <t:FieldURI FieldURI="calendar:Start"/>
                    <t:FieldURI FieldURI="calendar:End"/>
                    <t:FieldURI FieldURI="calendar:Location"/>
                    <t:FieldURI FieldURI="item:Attachments"/>
                </t:AdditionalProperties>
            </m:ItemShape>
            <m:CalendarView EndDate="2016-07-08T00:00:00Z" MaxEntriesReturned="999999" StartDate="2016-07-07T00:00:00Z"/>
            <m:ParentFolderIds>
                <t:DistinguishedFolderId Id="calendar"/>
            </m:ParentFolderIds>
        </m:FindItem>
    </s:Body>
</s:Envelope>

但我似乎遇到了一个错误:

<t:FieldURI FieldURI="item:Body"/>

错误信息

<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header>
    <h:ServerVersionInfo xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" MajorVersion="15" MinorVersion="1" MajorBuildNumber="534" MinorBuildNumber="21"/>
  </s:Header>
  <s:Body>
    <m:FindItemResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
      <m:ResponseMessages>
        <m:FindItemResponseMessage ResponseClass="Error">
          <m:MessageText>Property is not valid for this operation.</m:MessageText>
          <m:ResponseCode>ErrorInvalidPropertyForOperation</m:ResponseCode>
          <m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
          <m:MessageXml>
            <t:FieldURI FieldURI="item:Body"/>
          </m:MessageXml>
        </m:FindItemResponseMessage>
      </m:ResponseMessages>
    </m:FindItemResponse>
  </s:Body>
</s:Envelope>

我在这里查看了 API:

https://msdn.microsoft.com/en-us/library/office/aa494315(v=exchg.150).aspx

而且我想我一定遗漏了一些简单的东西。有没有办法使用基于特定字段的查询来获取日历正文?

谢谢

【问题讨论】:

    标签: outlook exchange-server exchangewebservices


    【解决方案1】:

    FindItem 操作不返回 Body、Attendees 和其他复杂/大型属性,请参阅 https://blogs.msdn.microsoft.com/vikas/2007/07/26/ews-why-does-not-finditem-return-all-the-fields-you-expected/

    因此,您需要获取从 FindItem 请求中获得的 ItemId,然后发出单个 GetItem 请求 https://msdn.microsoft.com/en-us/library/office/aa564509(v=exchg.150).aspx,或者如果您需要多个项目,则将 GetItem 请求一起批处理以提高效率。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-01
      • 1970-01-01
      • 2018-01-01
      • 1970-01-01
      • 2014-02-20
      相关资源
      最近更新 更多