CopyItem 操作CopyItem operation

CopyItem操作将复制项目,并将项目放在不同的文件夹中。The CopyItem operation copies items and puts the items in a different folder.

CopyItem 请求示例CopyItem request example

DescriptionDescription

以下示例的CopyItem请求显示如何构成将项目复制到收件箱的请求。The following example of a CopyItem request shows how to form a request to copy an item to the Inbox.

代码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>
    <CopyItem xmlns="https://schemas.microsoft.com/exchange/services/2006/messages">
      <ToFolderId>
        <t:DistinguishedFolderId Id="inbox"/>
      </ToFolderId>
      <ItemIds>
        <t:ItemId Id="AS4AUnV="/>
      </ItemIds>
    </CopyItem>
  </soap:Body>
</soap:Envelope>

备注Comments

备注

文件夹 ID 和更改密钥已缩短,以保持可读性。The folder ID and the change key have 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.

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

成功的 CopyItem 响应Successful CopyItem Response

DescriptionDescription

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

在响应消息中返回新项目的项目标识符。The item identifier of the new item is returned in the response message. 在对跨邮箱或邮箱到公用文件夹CopyItem操作的响应中,不会返回项目标识符。Item identifiers are not returned in responses for cross-mailbox or mailbox to public folder CopyItem operations.

代码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>
    <CopyItemResponse 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:CopyItemResponseMessage ResponseClass="Success">
          <m:ResponseCode>NoError</m:ResponseCode>
          <m:Items>
            <t:Message>
              <t:ItemID Id="AAMkAd" ChangeKey="FwAAABY" />
            </t:Message>
          </m:Items>
        </m:CopyItemResponseMessage>
      </m:ResponseMessages>
    </CopyItemResponse>
  </soap:Body>
</soap:Envelope>

成功的响应元素Successful response elements

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

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

CopyItem 错误响应CopyItem error response

DescriptionDescription

下面的示例演示对CopyItem请求的错误响应。The following example shows an error response to a CopyItem 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>
    <CopyItemResponse 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:CopyItemResponseMessage ResponseClass="Error">
          <m:MessageText>Id is malformed.</m:MessageText>
          <m:ResponseCode>ErrorInvalidIdMalformed</m:ResponseCode>
          <m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
          <m:Items />
        </m:CopyItemResponseMessage>
      </m:ResponseMessages>
    </CopyItemResponse>
  </soap:Body>
</soap:Envelope>

错误响应元素Error response elements

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

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

另请参阅See also