Sdílet prostřednictvím


MoveFolderType Class

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

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

Syntax

'Declaration
<SerializableAttribute> _
<DesignerCategoryAttribute("code")> _
<GeneratedCodeAttribute("wsdl", "2.0.50727.42")> _
<DebuggerStepThroughAttribute> _
<XmlTypeAttribute(Namespace:="https://schemas.microsoft.com/exchange/services/2006/messages")> _
Public Class MoveFolderType
    Inherits BaseMoveCopyFolderType
[SerializableAttribute] 
[DesignerCategoryAttribute("code")] 
[GeneratedCodeAttribute("wsdl", "2.0.50727.42")] 
[DebuggerStepThroughAttribute] 
[XmlTypeAttribute(Namespace="https://schemas.microsoft.com/exchange/services/2006/messages")] 
public class MoveFolderType : BaseMoveCopyFolderType
[SerializableAttribute] 
[DesignerCategoryAttribute(L"code")] 
[GeneratedCodeAttribute(L"wsdl", L"2.0.50727.42")] 
[DebuggerStepThroughAttribute] 
[XmlTypeAttribute(Namespace=L"https://schemas.microsoft.com/exchange/services/2006/messages")] 
public ref class MoveFolderType : public BaseMoveCopyFolderType
/** @attribute SerializableAttribute() */ 
/** @attribute DesignerCategoryAttribute("code") */ 
/** @attribute GeneratedCodeAttribute("wsdl", "2.0.50727.42") */ 
/** @attribute DebuggerStepThroughAttribute() */ 
/** @attribute XmlTypeAttribute(Namespace="https://schemas.microsoft.com/exchange/services/2006/messages") */ 
public class MoveFolderType extends BaseMoveCopyFolderType
SerializableAttribute 
DesignerCategoryAttribute("code") 
GeneratedCodeAttribute("wsdl", "2.0.50727.42") 
DebuggerStepThroughAttribute 
XmlTypeAttribute(Namespace="https://schemas.microsoft.com/exchange/services/2006/messages") 
public class MoveFolderType extends BaseMoveCopyFolderType

Remarks

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

Inheritance Hierarchy

System.Object
   ExchangeWebServices.BaseRequestType
     ExchangeWebServices.BaseMoveCopyFolderType
      ExchangeWebServices.MoveFolderType

Example

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;

    try
    {
        // 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)
    {
        Console.WriteLine(e.Message);
    }
}

Thread Safety

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

Platforms

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)