如何使用 FindItem 查询进行深度遍历
How to do deep traversals with FindItem queries
我正在使用 Office.context.mailbox.makeEwsRequestAsync
方法向 EWS 发送以下 XML 查询。只要 Traversal 设置为 "Shallow",它就可以工作。当我将遍历设置为 "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>
FindItem EWS 调用不支持遍历="Deep"。参见 FindItem。
这是因为调用将在 ParentFolderIds 中指定的文件夹中搜索项目。为了进行递归搜索,您需要使用支持在非 public 文件夹上遍历 ="Deep" 的 FindFolder EWS 操作来获取要包含在搜索中的文件夹列表。有关其他文档,请参阅 FindFolder。
我正在使用 Office.context.mailbox.makeEwsRequestAsync
方法向 EWS 发送以下 XML 查询。只要 Traversal 设置为 "Shallow",它就可以工作。当我将遍历设置为 "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>
FindItem EWS 调用不支持遍历="Deep"。参见 FindItem。
这是因为调用将在 ParentFolderIds 中指定的文件夹中搜索项目。为了进行递归搜索,您需要使用支持在非 public 文件夹上遍历 ="Deep" 的 FindFolder EWS 操作来获取要包含在搜索中的文件夹列表。有关其他文档,请参阅 FindFolder。