CopyItemType Class
Collapse the table of content
Expand the table of content
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

CopyItemType Class

The CopyItemType class represents an operation to copy items in a mailbox.

Namespace:  ExchangeWebServices
Assembly:  EWS (in EWS.dll)

<SerializableAttribute> _
Public Class CopyItemType _
	Inherits BaseMoveCopyItemType
Dim instance As CopyItemType

The item identifier of the new item is returned in the response message (CopyItemResponseType). Item identifiers are not returned in responses for a cross-mailbox or mailbox to public folder CopyItem Operation.

The following code example copies two items to the Inbox.

static void CopyItem(ExchangeServiceBinding esb)
    // Identify the items to copy.
    ItemIdType item1 = new ItemIdType();
    ItemIdType item2 = new ItemIdType();
    item1.Id = "AAAlAE1BQ1";
    item2.Id = "AAAlAE1BQ2";
    ItemIdType[] items = new ItemIdType[2] { item1, item2 };

    // Identify the destination folder.
    DistinguishedFolderIdType destFolder = new DistinguishedFolderIdType();
    destFolder.Id = DistinguishedFolderIdNameType.inbox;
    // Form the copy item request.
    CopyItemType request = new CopyItemType();
    request.ItemIds = items;
    request.ToFolderId = new TargetFolderIdType();
    request.ToFolderId.Item = destFolder;

        // Send the request and get the response.
        CopyItemResponseType response = esb.CopyItem(request);
        ArrayOfResponseMessagesType aormt = response.ResponseMessages;
        ResponseMessageType[] rmta = aormt.Items;

        foreach (ResponseMessageType rmt in rmta)
            if (rmt.ResponseClass == ResponseClassType.Success)
                Console.WriteLine("Successful item copy!");
    catch (Exception e)

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
© 2015 Microsoft