FindFolder 操作

FindFolder 操作使用 Exchange Web Services 查找已标识文件夹的子文件夹,并返回描述子文件夹集的属性集。

FindFolder 仅返回任何可流属性的前 512 个字节。 对于 Unicode,它通过使用以 null 结尾的 Unicode 字符串返回前 255 个字符。

无法对公用文件夹执行深层遍历查询。

允许限制,应仅使用文件夹属性,而不应使用项属性。 排序功能不适用于 FindFolder 响应。 分组查询不适用于 FindFolder 查询。

[!注意} FindFolder 操作还用于查找托管文件夹。

SOAP 标头

FindFolder 操作可以使用下表中列出的和描述的 SOAP 标头。

Header 元素 说明
模拟 ExchangeImpersonation 标识客户端应用程序正在模拟的用户。
MailboxCulture MailboxCulture 标识用于访问邮箱的 RFC3066 区域性。
RequestVersion RequestServerVersion 标识操作请求的架构版本。
ServerVersion ServerVersionInfo 标识响应请求的服务器版本。
TimeZoneContext TimeZoneContext 标识要用于服务器的所有响应的时区。

FindFolder 请求示例

下面的 FindFolder 请求示例演示如何形成请求以查找位于收件箱中的所有文件夹。

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types">
  <soap:Body>
    <FindFolder Traversal="Shallow" xmlns="https://schemas.microsoft.com/exchange/services/2006/messages">
      <FolderShape>
        <t:BaseShape>Default</t:BaseShape>
      </FolderShape>
      <ParentFolderIds>
        <t:DistinguishedFolderId Id="inbox"/>
      </ParentFolderIds>
    </FindFolder>
  </soap:Body>
</soap:Envelope>

使用 BaseShape 的默认值,响应将返回文件夹名称、文件夹 ID、子文件夹数、文件夹中找到的子文件夹数以及未读项目计数。

FindFolder 请求元素

FindFolder 请求包含以下元素:

有关其他 FindFolder 请求元素,请参阅架构。

FindFolder 响应示例

以下简单对象访问协议 (SOAP) 正文示例显示了对 FindFolder 请求的成功响应。 响应包含使用 BaseShape 的默认值时返回的元素。

注意

文件夹 ID 和更改密钥已缩短,以保持可读性。

<?xml version="1.0" encoding="utf-8" ?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" 
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
               xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Header>
    <t:ServerVersionInfo MajorVersion="8" MinorVersion="0" MajorBuildNumber="652" MinorBuildNumber="0" 
                         xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types" />
  </soap:Header>
  <soap:Body>
    <FindFolderResponse xmlns:m="https://schemas.microsoft.com/exchange/services/2006/messages" 
                        xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types" 
                        xmlns="https://schemas.microsoft.com/exchange/services/2006/messages">
      <m:ResponseMessages>
        <m:FindFolderResponseMessage ResponseClass="Success">
          <m:ResponseCode>NoError</m:ResponseCode>
          <m:RootFolder TotalItemsInView="1" IncludesLastItemInRange="true">
            <t:Folders>
              <t:Folder>
                <t:FolderId Id="AQAnAH" ChangeKey="AQAAABY" />
                <t:DisplayName>TestFolder</t:DisplayName>
                <t:TotalCount>0</t:TotalCount>
                <t:ChildFolderCount>0</t:ChildFolderCount>
                <t:UnreadCount>0</t:UnreadCount>
              </t:Folder>
            </t:Folders>
          </m:RootFolder>
        </m:FindFolderResponseMessage>
      </m:ResponseMessages>
    </FindFolderResponse>
  </soap:Body>
</soap:Envelope>

FindFolder 响应元素

响应中返回的属性由 BaseShapeAdditionalProperties (如果使用它们)确定。 成功的 FindFolder 响应包括以下元素:

对具有 AllProperties 响应形状的请求的 FindFolder 响应不会返回公用文件夹搜索的 TotalCountUnreadCount 元素。

FindFolder 错误响应示例

下面的 SOAP 正文示例显示了在搜索格式不正确的文件夹标识符标识的文件夹时发生的错误响应。

<?xml version="1.0" encoding="utf-8" ?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" 
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                 xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Header>
    <t:ServerVersionInfo MajorVersion="8" MinorVersion="0" MajorBuildNumber="652" MinorBuildNumber="0" 
                         xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types" />
  </soap:Header>
  <soap:Body>
    <FindFolderResponse xmlns:m="https://schemas.microsoft.com/exchange/services/2006/messages" 
                          xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types" 
                          xmlns="https://schemas.microsoft.com/exchange/services/2006/messages">
      <m:ResponseMessages>
        <m:FindFolderResponseMessage ResponseClass="Error">
          <m:MessageText>Id is malformed.</m:MessageText>
          <m:ResponseCode>ErrorInvalidIdMalformed</m:ResponseCode>
          <m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
        </m:FindFolderResponseMessage>
      </m:ResponseMessages>
    </FindFolderResponse>
  </soap:Body>
</soap:Envelope>

FindFolder 错误响应元素

FindFolder 错误响应包括以下元素:

其他信息

另请参阅

Finding Folders