CopyFolder 操作CopyFolder operation

CopyFolder 操作会复制邮箱中的文件夹。The CopyFolder operation copies folders in a mailbox.

使用 CopyFolder 操作Using the CopyFolder operation

CopyFolder 操作类似于MoveFolder 操作The CopyFolder operation is similar to the MoveFolder operation. 它会复制标识的文件夹,并返回已复制文件夹的IdChangeKeyIt copies identified folders and returns the Id and ChangeKey of the copied folders.

CopyFolder 请求示例CopyFolder request example

DescriptionDescription

以下示例的 CopyFolder 请求显示如何将文件夹复制到 "收件箱" 文件夹中。The following example of a CopyFolder request shows how to copy folders into the Inbox folder.

备注

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

代码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>
    <CopyFolder xmlns="https://schemas.microsoft.com/exchange/services/2006/messages">
      <ToFolderId>
        <t:DistinguishedFolderId Id="inbox"/>
      </ToFolderId>
      <FolderIds>
        <t:FolderId Id="AS4A=" ChangeKey="fsVU4=="/>
        <t:FolderId Id="AS4AU=" ChangeKey="fsVU4o=="/>
      </FolderIds>
    </CopyFolder>
  </soap:Body>
</soap:Envelope>

备注Comments

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

Request 元素Request elements

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

备注

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

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

成功的 CopyFolder 响应Successful CopyFolder response

DescriptionDescription

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

备注

文件夹 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="595" MinorBuildNumber="0" 
                         xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types" />
  </soap:Header>
  <soap:Body>
    <CopyFolderResponse 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:CopyFolderResponseMessage ResponseClass="Success">
          <m:ResponseCode>NoError</m:ResponseCode>
          <m:Folders>
            <t:Folder>
              <t:FolderId Id="AS4AUn=" ChangeKey="fsVU4o==" />
            </t:Folder>
          </m:Folders>
        </m:CopyFolderResponseMessage>
      </m:ResponseMessages>
    </CopyFolderResponse>
  </soap:Body>
</soap:Envelope>

评论Comment

响应中返回的FolderId元素表示在新文件夹位置中复制的文件夹。The FolderId element that is returned in the response represents the folder that was copied in the new folder location.

Response 元素Response elements

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

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

CopyFolder 错误响应CopyFolder error response

DescriptionDescription

下面的示例演示对 CopyFolder 请求的错误响应。The following example shows an error response to a CopyFolder request. 出现此错误的原因是已经存在具有相同显示名称的文件夹。The error occurred because a folder with the same display name already exists.

代码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>
    <CopyFolderResponse 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:CopyFolderResponseMessage ResponseClass="Error">
          <m:MessageText>The move or copy operation failed.</m:MessageText>
          <m:ResponseCode>ErrorMoveCopyFailed</m:ResponseCode>
          <m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
          <m:Folders />
        </m:CopyFolderResponseMessage>
      </m:ResponseMessages>
    </CopyFolderResponse>
  </soap:Body>
</soap:Envelope>

错误响应元素Error response elements

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

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

另请参阅See also