MoveFolder 操作MoveFolder operation

MoveFolder 操作将文件夹从指定文件夹移动,并将其放在另一个文件夹中。The MoveFolder operation moves folders from a specified folder and puts them in another folder.

备注Remarks

MoveFolder 操作类似于 CopyFolder 操作。The MoveFolder operation is similar to the CopyFolder operation. 无法移动可分辨文件夹。You cannot move distinguished folders. 您可以一次将多个文件夹移动到目标文件夹。You can move multiple folders at one time to the destination folder.

MoveFolder 请求示例MoveFolder request example

DescriptionDescription

以下示例的 MoveFolder 请求显示如何形成一个请求,以移动FolderId标识的文件夹,并将该文件夹放在 "垃圾邮件" 可分辨文件夹中。The following example of a MoveFolder request shows how to form a request to move a folder identified by the FolderId and put the folder in the Junk E-mail distinguished 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>
    <MoveFolder xmlns="https://schemas.microsoft.com/exchange/services/2006/messages">
      <ToFolderId>
        <t:DistinguishedFolderId Id="junkemail"/>
      </ToFolderId>
      <FolderIds>
        <t:FolderId Id="AScAc"/>
      </FolderIds>
    </MoveFolder>
  </soap:Body>
</soap:Envelope>

备注Comments

备注

为了提高可读性, FolderId元素的 ID 属性值已缩短。The value of the ID attribute of the FolderId element has been shortened for readability.

Request 元素Request elements

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

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

备注

架构的默认位置在安装了客户端访问服务器角色的计算机上的 EWS 虚拟目录中。The default location of the schema is in the EWS virtual directory on the computer that has the Client Access server role installed.

成功的 MoveFolder 响应示例Successful MoveFolder response example

DescriptionDescription

下面的示例演示对 MoveFolder 请求的成功响应。The following example shows a successful response to the MoveFolder 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="685" MinorBuildNumber="8" 
                         xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types" />
  </soap:Header>
  <soap:Body>
    <MoveFolderResponse 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:MoveFolderResponseMessage ResponseClass="Success">
          <m:ResponseCode>NoError</m:ResponseCode>
          <m:Folders>
            <t:Folder>
              <t:FolderId Id="AAAlAFV" ChangeKey="AQAAAB" />
            </t:Folder>
          </m:Folders>
        </m:MoveFolderResponseMessage>
      </m:ResponseMessages>
    </MoveFolderResponse>
  </soap:Body>
</soap:Envelope>

备注Comments

备注

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

响应中返回的 FolderId 表示移动到新文件夹位置的文件夹。The FolderId that is returned in the response represents the folder that was moved to the new the folder location.

Response 元素Response elements

MoveFolder 响应包括以下元素:The MoveFolder response includes the following elements:

MoveFolder 错误响应示例MoveFolder Error response example

DescriptionDescription

下面的示例演示在尝试移动可分辨文件夹时发生的错误响应。The following example shows an error response that occurs when you try to move a distinguished folder.

代码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="685" MinorBuildNumber="8" 
                         xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types" />
  </soap:Header>
  <soap:Body>
    <MoveFolderResponse 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:MoveFolderResponseMessage ResponseClass="Error">
          <m:MessageText>Cannot move distinguished folder.</m:MessageText>
          <m:ResponseCode>ErrorMoveDistinguishedFolder</m:ResponseCode>
          <m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
          <m:Folders />
        </m:MoveFolderResponseMessage>
      </m:ResponseMessages>
    </MoveFolderResponse>
  </soap:Body>
</soap:Envelope>

错误响应元素Error response elements

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

另请参阅See also

CopyFolder 操作CopyFolder operation