MoveFolderType Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
The MoveFolderType class represents an operation to move folders in a mailbox.
public ref class MoveFolderType : ExchangeWebServices::BaseMoveCopyFolderType
public class MoveFolderType : ExchangeWebServices.BaseMoveCopyFolderType
Public Class MoveFolderType
Inherits BaseMoveCopyFolderType
- Inheritance
Examples
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 <span class="label">request</span> = new MoveFolderType();
<span class="label">request</span>.FolderIds = folders;
<span class="label">request</span>.ToFolderId = new TargetFolderIdType();
<span class="label">request</span>.ToFolderId.Item = destFolder;
try
{
// Send the request and get the response.
MoveFolderResponseType response = esb.MoveFolder(<span class="label">request</span>);
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)
{
Console.WriteLine(e.Message);
}
}
Remarks
The folder identifier and change key do not change when you move a folder. You cannot move default folders.
Constructors
MoveFolderType() |
The MoveFolderType constructor initializes a new instance of the MoveFolderType class. |
Properties
FolderIds |
The FolderIds property gets or sets an array of folders to move or copy to the folder that is identified by the ToFolderId property. (Inherited from BaseMoveCopyFolderType) |
ToFolderId |
The ToFolderId property gets or sets the destination folder for a moved or copied folder. (Inherited from BaseMoveCopyFolderType) |