GetFolder 操作GetFolder operation

GetFolder操作从 Exchange 存储中获取文件夹。The GetFolder operation gets folders from the Exchange store.

GetFolder 请求示例GetFolder request example

DescriptionDescription

下面的GetFolder请求示例演示如何获取文件夹标识符、显示名称、该文件夹中的项目数、子文件夹数以及文件夹中未读项目的数量。The following example of a GetFolder request shows how to obtain a folder identifier, display name, the count of items in that folder, the count of child folders, and the number of unread items in the folder.

代码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>
    <GetFolder xmlns="https://schemas.microsoft.com/exchange/services/2006/messages"
               xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types">
      <FolderShape>
        <t:BaseShape>Default</t:BaseShape>
      </FolderShape>
      <FolderIds>
        <t:DistinguishedFolderId Id="inbox"/>
      </FolderIds>
    </GetFolder>
  </soap:Body>
</soap:Envelope>

Request 元素Request elements

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

有关可用于形成GetFolder请求的其他元素,请参阅架构。See the schema for additional elements that you can use to form a GetFolder request.

备注

描述此元素的架构位于承载 Exchange Web Services 的 IIS 虚拟目录中。The schema that describes this element is located in the IIS virtual directory that hosts Exchange Web Services.

GetFolder 响应示例GetFolder response example

DescriptionDescription

下面的简单对象访问协议(SOAP)正文示例显示了对GetFolder请求的成功响应。The following Simple Object Access Protocol (SOAP) body example shows a successful response to the GetFolder request.

备注

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

代码Code

<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="628" MinorBuildNumber="0" 
                         xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types" />
  </soap:Header>
  <soap:Body>
    <GetFolderResponse 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:GetFolderResponseMessage ResponseClass="Success">
          <m:ResponseCode>NoError</m:ResponseCode>
          <m:Folders>
            <t:Folder>
              <t:FolderId Id="AQApA=" ChangeKey="AQAAAB" />
              <t:DisplayName>Inbox</t:DisplayName>
              <t:TotalCount>2</t:TotalCount>
              <t:ChildFolderCount>0</t:ChildFolderCount>
              <t:UnreadCount>2</t:UnreadCount>
            </t:Folder>
          </m:Folders>
        </m:GetFolderResponseMessage>
      </m:ResponseMessages>
    </GetFolderResponse>
  </soap:Body>
</soap:Envelope>

Response 元素Response elements

GetFolder响应包括以下元素:This GetFolder response includes the following elements:

GetFolder 错误响应示例GetFolder Error response example

DescriptionDescription

以下 SOAP 正文示例显示了由请求中的错误FolderId导致的错误响应。The following SOAP body example shows an error response that is caused by an incorrect FolderId in the request.

代码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="628" MinorBuildNumber="0" 
                         xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types" />
  </soap:Header>
  <soap:Body>
    <GetFolderResponse 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:GetFolderResponseMessage ResponseClass="Error">
          <m:MessageText>Id is malformed.</m:MessageText>
          <m:ResponseCode>ErrorInvalidIdMalformed</m:ResponseCode>
          <m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
          <m:Folders />
        </m:GetFolderResponseMessage>
      </m:ResponseMessages>
    </GetFolderResponse>
  </soap:Body>
</soap:Envelope>

Response 元素Response elements

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

版本差异Version differences

对于面向 Exchange Online 的应用程序,Exchange Online 作为 Office 365 的一部分,或从 Exchange 2013 开始的 Exchange 内部部署版本,当BaseShape元素的GetFolder操作请求中的值为AllProperties时,不会返回文件夹权限。For applications that target Exchange Online, Exchange Online as part of Office 365, or an on-premises version of Exchange starting with Exchange 2013, folder permissions are not returned when the BaseShape element has a value of AllProperties in the GetFolder operation request. 若要检索文件夹权限,请将PermissionSet (PermissionSetType)元素添加到GetFolder请求中的AdditionalProperties元素。To retrieve folder permissions, add the PermissionSet (PermissionSetType) element to the AdditionalProperties element in the GetFolder request.

另请参阅See also