FindFolder 操作FindFolder operation

FindFolder操作使用 Exchange Web 服务查找已标识文件夹的子文件夹,并返回一组用于描述子文件夹集的属性。The FindFolder operation uses Exchange Web Services to find subfolders of an identified folder and returns a set of properties that describe the set of subfolders.

备注Remarks

FindFolder 仅返回任何 streamable 属性的前512个字节。FindFolder returns only the first 512 bytes of any streamable property. 对于 Unicode,它通过使用以 null 结尾的 Unicode 字符串返回前255个字符。For Unicode, it returns the first 255 characters by using a null-terminated Unicode string.

无法对公用文件夹执行深度遍历查询。Deep traversal queries cannot be performed on public folders.

限制是允许的,并且应仅使用文件夹属性,而不应使用项目属性。Restrictions are permitted and should use only the folder properties, not the item properties. 排序功能对FindFolder响应不可用。Sorting functionality is not available for FindFolder responses. 分组查询不适用于FindFolder查询。Grouped queries are not available for FindFolder queries.

注释****FindFolder操作还用于查找托管文件夹。Note The FindFolder operation is also used to find managed folders.

SOAP 标头SOAP Headers

FindFolder操作可以使用下表中列出和描述的 SOAP 标头。The FindFolder operation can use the SOAP headers that are listed and described in the following table.

HeaderHeader 元素Element 说明Description
模拟Impersonation
ExchangeImpersonationExchangeImpersonation
标识客户端应用程序模拟的用户。Identifies the user whom the client application is impersonating.
MailboxCultureMailboxCulture
MailboxCultureMailboxCulture
标识要用于访问邮箱的 RFC3066 区域性。Identifies the RFC3066 culture to be used to access the mailbox.
RequestVersionRequestVersion
RequestServerVersionRequestServerVersion
标识操作请求的架构版本。Identifies the schema version for the operation request.
ServerVersionServerVersion
ServerVersionInfoServerVersionInfo
标识响应请求的服务器版本。Identifies the version of the server that responded to the request.
TimeZoneContextTimeZoneContext
TimeZoneContextTimeZoneContext
标识要用于来自服务器的所有响应的时区。Identifies the time zone to be used for all responses from the server.

FindFolder 请求示例FindFolder request example

DescriptionDescription

下面的FindFolder请求示例演示如何在请求中查找位于收件箱中的所有文件夹。The following example of a FindFolder request shows how to form a request to find all the folders located in an Inbox.

代码Code

<?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>

备注Comments

通过使用BaseShape的默认值,响应将返回文件夹名称、文件夹 ID、子文件夹数、文件夹中找到的子文件夹数以及未读项目的计数。Using the Default value for the BaseShape, the response returns the folder name, the folder ID, the number of subfolders, the number of child folders found in the folder, and the count of unread items.

Request 元素Request elements

FindFolder请求包括以下元素:This FindFolder request includes the following elements:

有关其他FindFolder请求元素,请参阅架构。For additional FindFolder request elements, see the schema.

FindFolder 响应示例FindFolder response example

DescriptionDescription

下面的简单对象访问协议(SOAP)正文示例显示了对FindFolder请求的成功响应。The following Simple Object Access Protocol (SOAP) body example shows a successful response to the FindFolder request. 响应包含在使用BaseShape的默认值时返回的元素。The response contains the elements that are returned when the Default value for the BaseShape is used.

备注

文件夹 ID 和更改密钥已缩短,以保持可读性。The folder ID and the change key have been shortened to preserve readability.

代码Code

<?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>

Response 元素Response elements

在响应中返回的属性由BaseShapeAdditionalProperties (如果使用它们)决定。The properties that are returned in the response are determined by the BaseShape and the AdditionalProperties if they are used. 成功的FindFolder响应包括以下元素:A successful FindFolder response includes the following elements:

备注Comments

对具有AllProperties响应形状的请求的FindFolder响应不会返回公用文件夹搜索的TotalCountUnreadCount元素。FindFolder responses to a request with the AllProperties response shape will not return the TotalCount and UnreadCount elements for public folder searches.

FindFolder 错误响应示例FindFolder Error response example

DescriptionDescription

下面的 SOAP 正文示例显示当您搜索由格式错误的文件夹标识符标识的文件夹时发生的错误响应。The following SOAP body example shows an error response that occurs when you search for a folder that is identified by a malformed folder identifier.

代码Code

<?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>

错误响应元素Error response elements

FindFolder错误响应包括以下元素:The FindFolder error response includes the following elements:

其他信息Additional Information

  • 文件夹DisplayName (string)元素始终包含在默认形状中。The folder DisplayName (string) element is always included in the default shape.

  • " UnreadCount " 元素包含在 "任务" 和 "便笺" 文件夹中。The UnreadCount element is included in Tasks and Notes folders.

  • 使用具有Integer属性类型的0X672D 的PropertyTag值,以使用ExtendedFieldURI元素标识托管文件夹。Use the PropertyTag value of 0x672D with a property type of Integer to identify a managed folder by using the ExtendedFieldURI element.

另请参阅See also

Finding FoldersFinding Folders