This documentation is archived and is not being maintained.

MoveFolderType Class

The MoveFolderType class represents an operation to move folders in a mailbox.

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

[GeneratedCodeAttribute("wsdl", "2.0.50727.42")] 
public class MoveFolderType : BaseMoveCopyFolderType
/** @attribute SerializableAttribute() */ 
/** @attribute DesignerCategoryAttribute("code") */ 
/** @attribute GeneratedCodeAttribute("wsdl", "2.0.50727.42") */ 
/** @attribute DebuggerStepThroughAttribute() */ 
/** @attribute XmlTypeAttribute(Namespace="") */ 
public class MoveFolderType extends BaseMoveCopyFolderType
GeneratedCodeAttribute("wsdl", "2.0.50727.42") 
public class MoveFolderType extends BaseMoveCopyFolderType

The folder identifier and change key do not change when you move a folder. You cannot move default folders.

The following example shows you how to move two folders to another folder.

static void MoveFolder(ExchangeServiceBinding esb)
    // Identify the folders to move.
    FolderIdType folder1 = new FolderIdType();
    FolderIdType folder2 = new FolderIdType();
    folder1.Id = "AQAlAE1BQG1";
    folder2.Id = "AQAlAE1BQG3";
    FolderIdType[] folders = new FolderIdType[2] { folder1, folder2 };

    // Identify the destination folder.
    DistinguishedFolderIdType destFolder = new DistinguishedFolderIdType();
    destFolder.Id = DistinguishedFolderIdNameType.drafts;

    // Form the move folder request.
    MoveFolderType request = new MoveFolderType();
    request.FolderIds = folders;
    request.ToFolderId = new TargetFolderIdType();
    request.ToFolderId.Item = destFolder;

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

        foreach (ResponseMessageType rmt in rmta)
            if (rmt.ResponseClass == ResponseClassType.Error)
                throw new Exception("Folder move failed.");

    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.

Development Platforms

Windows XP Professional with Service Pack 2 (SP2), Windows Server 2003,

Target Platforms

Windows 98, Windows 2000, Windows 2000 Server, Windows CE, Windows Longhorn, Windows 98 Second Edition, Pocket PC, Smart Phone, Windows Server 2003, Windows XP Professional with Service Pack 2 (SP2)