EmptyFolder 操作EmptyFolder operation

EmptyFolder操作将清空邮箱中的文件夹。The EmptyFolder operation empties folders in a mailbox. (可选)此操作使您可以删除指定文件夹的子文件夹。Optionally, this operation enables you to delete the subfolders of the specified folder. 删除子文件夹时,子文件夹和子文件夹中的邮件将被删除。When a subfolder is deleted, the subfolder and the messages within the subfolder are deleted.

EmptyFolder 请求示例EmptyFolder request example

DescriptionDescription

以下示例的EmptyFolder请求显示了如何形成空文件夹的请求。This following example of an EmptyFolder request shows how to form a request to empty a folder. 本示例删除已标识文件夹的所有子文件夹。This example deletes all subfolders of the identified folder.

备注

为了提高可读性, FolderId元素的IdChangeKey属性的值已缩短。The values of the Id and the ChangeKey attributes of the FolderId element have been shortened for readability.

代码Code

<soap:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
               xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
               xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types"
               xmlns:m="https://schemas.microsoft.com/exchange/services/2006/messages">
  <soap:Header>
    <t:RequestServerVersion Version ="Exchange2010_SP1"/>
    </soap:Header>
    <soap:Body>
      <m:EmptyFolder DeleteType="HardDelete" DeleteSubFolders="true">
        <m:FolderIds>
          <t:FolderId Id="AQMkADhhOGU0"  ChangeKey="AQAAABYAAABsMB" />
        </m:FolderIds>
      </m:EmptyFolder>
    </soap:Body>
</soap:Envelope>

备注Comments

本示例对文件夹执行硬删除。This example performs a hard delete on the folder.

可以通过DistinguishedFolderId元素或FolderId元素标识文件夹,以便在FolderIds元素中使用。Folders can be identified by either the DistinguishedFolderId element or the FolderId element for use in the FolderIds element.

Request 元素Request elements

请求中使用以下元素:The following elements are used in the request:

成功的 EmptyFolder 响应Successful EmptyFolder response

DescriptionDescription

下面的示例演示对EmptyFolder请求的成功响应。The following example shows a successful response to the EmptyFolder request.

代码Code

<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header>
    <h:ServerVersionInfo MajorVersion="14" 
                         MinorVersion="1" 
                         MajorBuildNumber="164" 
                         MinorBuildNumber="0" 
                         Version="Exchange2010_SP1"
                         xmlns:h="https://schemas.microsoft.com/exchange/services/2006/types"
                         xmlns="https://schemas.microsoft.com/exchange/services/2006/types"
                         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                         xmlns:xsd="http://www.w3.org/2001/XMLSchema"/>
  </s:Header>
  <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <m:EmptyFolderResponse xmlns:m="https://schemas.microsoft.com/exchange/services/2006/messages"
                           xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types">
      <m:ResponseMessages>
        <m:EmptyFolderResponseMessage ResponseClass="Success">
          <m:ResponseCode>NoError</m:ResponseCode>
        </m:EmptyFolderResponseMessage>
      </m:ResponseMessages>
    </m:EmptyFolderResponse>
  </s:Body>
</s:Envelope>

成功的响应元素Successful response elements

响应中使用以下元素:The following elements are used in the response:

EmptyFolder 错误响应EmptyFolder error response

DescriptionDescription

下面的示例演示对Emptyfolder请求的错误响应。The following example shows an error response to an Emptyfolder request. 已创建错误,因为该操作尝试清空 Exchange 存储中未找到的文件夹。The error was created because the operation tried to empty a folder that was not found in the Exchange store.

代码Code

<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header>
    <h:ServerVersionInfo MajorVersion="14" 
            MinorVersion="1" 
            MajorBuildNumber="164" 
            MinorBuildNumber="0" 
            Version="Exchange2010_SP1" 
            xmlns:h="https://schemas.microsoft.com/exchange/services/2006/types" 
            xmlns="https://schemas.microsoft.com/exchange/services/2006/types" 
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
            xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
  </s:Header>
  <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
            xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <m:GetFolderResponse 
          xmlns:m="https://schemas.microsoft.com/exchange/services/2006/messages" 
          xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types">
      <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>
    </m:GetFolderResponse>
  </s:Body>
</s:Envelope>

错误响应元素Error response elements

响应中使用以下元素:The following elements are used in the response:

另请参阅See also