Sdílet prostřednictvím


UpdateFolderType Class

The UpdateFolderType class represents a request to update folders in a mailbox.

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

Syntax

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

Remarks

You can append, set, or delete properties when you are updating a folder.

The following table lists the error response codes that can be returned for an UpdateFolder operation.

ResponseCode

Description

ErrorInvalidPropertySet

An attempt was made to set a value for a property that is read-only.

ErrorChangeKeyRequiredForWriteOperations

A change key was not provided for the update operation.

ErrorIncorrectUpdatePropertyCount

An attempt was made to submit a change description that includes more than one property to modify.

Inheritance Hierarchy

System.Object
   ExchangeWebServices.BaseRequestType
    ExchangeWebServices.UpdateFolderType

Example

The following code example shows you how to update the display name of a folder. The folder identifier and change key have been shortened to preserve readability.

static void UpdateFolder(ExchangeServiceBinding esb)
{
    // Create the container for the set of updates to be made to the folders.
    FolderChangeType changes = new FolderChangeType();

    // Identify the folder to change.
    FolderIdType folderId = new FolderIdType();
    folderId.Id = "AQAlAE1BQG1h=";
    folderId.ChangeKey = "AQAAABYA";
    changes.Item = folderId;

    // Create the update. Identify the field to update and the value to set for it.
    SetFolderFieldType uDisplayName = new SetFolderFieldType();
    PathToUnindexedFieldType displayNameProp = new PathToUnindexedFieldType();
    displayNameProp.FieldURI = UnindexedFieldURIType.folderDisplayName;
    FolderType updatedFolder = new FolderType();
    updatedFolder.DisplayName = "My new folder name";
    uDisplayName.Item = displayNameProp; 
    uDisplayName.Item1 = updatedFolder;
    
    // Add the folder to change.
    changes.Item = folderId;

    // Add the array of changes; in this case, a single element array.
    changes.Updates = new FolderChangeDescriptionType[1] { uDisplayName };

    // Add changes to the request.
    UpdateFolderType request = new UpdateFolderType();
    request.FolderChanges = new FolderChangeType[1] { changes };

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

    // Get the new change key for the updated folder.
    foreach (ResponseMessageType rmt in rmta)
    {
        FolderInfoResponseMessageType firmt = (rmt as FolderInfoResponseMessageType);

        foreach (BaseFolderType folder in firmt.Folders)
        {
            Console.WriteLine("New change key: " + folder.FolderId.ChangeKey);
        }
    }
}

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)