0

我正在使用该Office.context.mailbox.makeEwsRequestAsync方法向 EWS 发送以下 XML 查询。只要 Traversal 设置为“Shallow”,它就可以工作。当我将 Traversal 设置为“Deep”时,我收到“The request is invalid”错误。如果无法进行深度搜索,如何递归搜索子文件夹?

  <?xml version="1.0" encoding="utf-8"?> 
  <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> 
    <soap:Header> 
      <t:RequestServerVersion Version="Exchange2013_SP1" /> 
    </soap:Header> 
    <soap:Body> 
      <m:FindItem Traversal="Shallow"> 
        <m:ItemShape> 
          <t:BaseShape>AllProperties</t:BaseShape> 
        </m:ItemShape> 
        <m:IndexedPageItemView MaxEntriesReturned="10" Offset="0" BasePoint="Beginning" /> 
        <m:Restriction> 
          <t:Contains ContainmentMode="FullString" ContainmentComparison="IgnoreCase"> 
            <t:FieldURI FieldURI="item:Categories" /> 
            <t:Constant Value="MyCategory" /> 
          </t:Contains> 
        </m:Restriction> 
        <m:ParentFolderIds> 
          <t:DistinguishedFolderId Id="inbox" /> 
          <t:DistinguishedFolderId Id="sentitems" /> 
        </m:ParentFolderIds> 
      </m:FindItem> 
    </soap:Body> 
  </soap:Envelope>
4

1 回答 1

2

FindItem EWS 调用不支持 Traversal="Deep"。请参阅FindItem

这是因为调用将在 ParentFolderIds 中指定的文件夹中搜索项目。为了进行递归搜索,您需要使用 FindFolder EWS 操作获取要包含在搜索中的文件夹列表,该操作在非公用文件夹上支持 Traversal="Deep"。有关其他文档,请参阅FindFolder

于 2016-06-13T03:07:06.040 回答