MoveItem 操作MoveItem operation

MoveItem操作用于将一个或多个项目移至单个目标文件夹。The MoveItem operation is used to move one or more items to a single destination folder.

MoveItem 请求示例MoveItem request example

DescriptionDescription

以下示例的MoveItem请求显示如何将项目移动到 "草稿" 文件夹。The following example of a MoveItem request shows how to move an item to the Drafts folder.

代码Code

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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">
  <soap:Body>
    <MoveItem xmlns="https://schemas.microsoft.com/exchange/services/2006/messages"
    xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types">
      <ToFolderId>
        <t:DistinguishedFolderId Id="drafts"/>
      </ToFolderId>
      <ItemIds>
        <t:ItemId Id="AAAtAEF/swbAAA=" ChangeKey="EwAAABYA/s4b"/>
      </ItemIds>
    </MoveItem>
  </soap:Body>
</soap:Envelope>

备注Comments

ToFolderId元素指定要将项目移动到的文件夹。The ToFolderId element specifies the folder to which the items will be moved. 请注意, ItemIds集合中列出的所有项将在目标文件夹中结束。Note that all items listed in the ItemIds collection will end up in the destination folder. 您必须单独进行MoveItem调用,以将项目放在不同的目标文件夹中。You must make separate MoveItem calls to place items in different destination folders.

备注

项目标识符和更改密钥已缩短,以保持可读性。The item identifier and change key have been shortened to preserve readability.

Request 元素Request elements

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

MoveItem 响应示例MoveItem response example

DescriptionDescription

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

在响应消息中返回新项目的项目标识符。The item identifier of the new item is returned in the response message. 在对跨邮箱或邮箱到公用文件夹MoveItem操作的响应中,不会返回项目标识符。Item identifiers are not returned in responses for cross-mailbox or mailbox to public folder MoveItem 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="662" MinorBuildNumber="0" 
                         xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types"/>
  </soap:Header>
  <soap:Body>
    <MoveItemResponse 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:MoveItemResponseMessage ResponseClass="Success">
          <m:ResponseCode>NoError</m:ResponseCode>
          <m:Items>
            <t:Message>
              <t:ItemID Id="AAMkAd" ChangeKey="FwAAABY" />
            </t:Message>
          </m:Items>
        </m:MoveItemResponseMessage>
      </m:ResponseMessages>
    </MoveItemResponse>
  </soap:Body>
</soap:Envelope>

备注Comments

如果移动成功, MoveItem操作将指示成功。The MoveItem operation will indicate success if the move was successful.

成功的响应元素Successful response elements

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

另请参阅See also