DeleteFolder 操作DeleteFolder operation

DeleteFolder操作从邮箱中删除文件夹。The DeleteFolder operation deletes folders from a mailbox.

DeleteFolder 请求示例DeleteFolder request example

DescriptionDescription

下面的DeleteFolder请求示例演示如何在表单中组成删除文件夹的请求。This following example of a DeleteFolder request shows how to form a request to delete a 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>
    <DeleteFolder xmlns="https://schemas.microsoft.com/exchange/services/2006/messages"
                  xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types" 
                  DeleteType="HardDelete" >
      <FolderIds>
        <t:FolderId Id="AS4AUnVz=" />
      </FolderIds>
    </DeleteFolder>
  </soap:Body>
</soap:Envelope>

备注Comments

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

备注

文件夹 ID 已缩短,以保持可读性。The folder ID has been shortened to preserve readability.

Request 元素Request elements

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

备注

描述此元素的架构位于运行 Microsoft Exchange Server 2010 且安装了客户端访问服务器角色的计算机的 EWS 虚拟目录中。The schema that describes this element is located in the EWS virtual directory of the computer that is running Microsoft Exchange Server 2010 that has the Client Access server role installed.

若要查找DeleteFolder操作的请求消息的其他选项,请浏览架构层次结构。To find other options for the request message of the DeleteFolder operation, explore the schema hierarchy. DeleteFolder元素开始。Start at the DeleteFolder element.

成功的 DeleteFolder 响应Successful DeleteFolder response

DescriptionDescription

下面的示例演示对DeleteFolder请求的成功响应。The following example shows a successful response to the DeleteFolder 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="595" MinorBuildNumber="0" 
                         xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types" />
  </soap:Header>
  <soap:Body>
    <DeleteFolderResponse 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:DeleteFolderResponseMessage ResponseClass="Success">
          <m:ResponseCode>NoError</m:ResponseCode>
        </m:DeleteFolderResponseMessage>
      </m:ResponseMessages>
    </DeleteFolderResponse>
  </soap:Body>
</soap:Envelope>

Response 元素Response elements

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

若要查找DeleteFolder操作的响应邮件的其他选项,请浏览架构层次结构。To find other options for the response message of the DeleteFolder operation, explore the schema hierarchy. DeleteFolderResponse元素开始。Start at the DeleteFolderResponse element.

DeleteFolder 错误响应DeleteFolder error response

DescriptionDescription

下面的示例演示对DeleteFolder请求的错误响应。The following example shows an error response to a DeleteFolder request. 此错误是由于请求删除邮箱中不存在的文件夹所致。The error was caused by a request to delete a folder that was not present in the mailbox.

代码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="595" MinorBuildNumber="0" 
                         xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types" />
  </soap:Header>
  <soap:Body>
    <DeleteFolderResponse 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:DeleteFolderResponseMessage ResponseClass="Error">
          <m:MessageText>The specified object was not found in the store.</m:MessageText>
          <m:ResponseCode>ErrorItemNotFound</m:ResponseCode>
          <m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
        </m:DeleteFolderResponseMessage>
      </m:ResponseMessages>
    </DeleteFolderResponse>
  </soap:Body>
</soap:Envelope>

备注Comments

不能在可分辨文件夹上使用DeleteFolder操作。The DeleteFolder operation cannot be used on distinguished folders.

错误响应元素Error response elements

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

若要查找DeleteFolder操作的错误响应消息的其他选项,请浏览架构层次结构。To find other options for the error response message of the DeleteFolder operation, explore the schema hierarchy. DeleteFolderResponse元素开始。Start at the DeleteFolderResponse element.

另请参阅See also