创建逻辑Outlook搜索文件夹会减少搜索延迟吗?

时间:2016-10-10 19:10:19

标签: outlook-addin exchangewebservices

我创建了一个逻辑搜索文件夹,用于包含具有特定类别的所有电子邮件。然后我使用FindItem + ParentFolderIds查询来提取这些电子邮件。此FindItem查询的速度似乎与帐户中的电子邮件总数成比例,而不是逻辑搜索文件夹中的电子邮件数量。这是正常行为吗?

以下是创建搜索文件夹的查询:

  <?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="Exchange2010" />
    </soap:Header>
    <soap:Body>
      <m:CreateFolder>
        <m:ParentFolderId>
          <t:DistinguishedFolderId Id="searchfolders" />
        </m:ParentFolderId>
        <m:Folders>
          <t:SearchFolder>
            <t:DisplayName>MySearchFolder</t:DisplayName>
            <t:PermissionSet>
              <t:Permissions />
            </t:PermissionSet>
            <t:SearchParameters Traversal="Deep">
              <t:Restriction>
                <t:Contains ContainmentMode="FullString" ContainmentComparison="IgnoreCase">
                  <t:FieldURI FieldURI="item:Categories" />
                  <t:Constant Value="My_Category" />
                </t:Contains>
              </t:Restriction>
              <t:BaseFolderIds>
                <t:DistinguishedFolderId Id="root" />
              </t:BaseFolderIds>
            </t:SearchParameters>
          </t:SearchFolder>
        </m:Folders>
      </m:CreateFolder>
    </soap:Body>
  </soap:Envelope>

以下是从搜索文件夹中检索电子邮件的查询:

<?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="1000" Offset="0" BasePoint="Beginning" />
        <m:Restriction>
          <t:IsEqualTo>
              <t:FieldURI FieldURI="item:IsDraft" />
              <t:FieldURIOrConstant>
                <t:Constant Value="false" />
             </t:FieldURIOrConstant>
          </t:IsEqualTo>
        </m:Restriction>
        <m:ParentFolderIds>
          <t:FolderId Id="<The_SEARCH_FOLDER_ID>" /> 
        </m:ParentFolderIds>
      </m:FindItem>
    </soap:Body>
  </soap:Envelope>

1 个答案:

答案 0 :(得分:0)

请注意,物品实际上并不是&#34;在&#34;搜索文件夹。搜索文件夹实际上只是一个持久的搜索结果,您可以将其视为文件夹。因此,这些项目仍然分布在邮箱中的不同文件夹中。

当您查询搜索文件夹时,您正在添加第二个限制(IsDraft = false),这可能导致重新评估结果。

相关问题