UpdateFolderType クラス

定義

クラスは UpdateFolderType 、メールボックス内のフォルダーを更新する要求を表します。

public ref class UpdateFolderType : ExchangeWebServices::BaseRequestType
public class UpdateFolderType : ExchangeWebServices.BaseRequestType
Public Class UpdateFolderType
Inherits BaseRequestType
継承
UpdateFolderType

次のコード例は、フォルダーの表示名を更新する方法を示しています。 読みやすくするために、フォルダー識別子と変更キーが短縮されました。

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 <span class="label">request</span> = new <span class="label">UpdateFolderType</span>();
<span class="label">request</span>.FolderChanges = new FolderChangeType[1] { changes };

    // Send the request and get the response.
    UpdateFolderResponseType response = esb.UpdateFolder(<span class="label">request</span>);
    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);
        }
    }
}

注釈

フォルダーを更新するときに、プロパティを追加、設定、または削除できます。

次の表に、UpdateFolder 操作で返すことができるエラー応答コードを示します。

UpdateFolder 操作エラー応答コード

ErrorInvalidPropertySet読み取り専用のプロパティの値を設定しようとしました。
ErrorChangeKeyRequiredForWriteOperations更新操作に変更キーが指定されませんでした。
ErrorIncorrectUpdatePropertyCount変更する複数のプロパティを含む変更の説明を送信しようとしました。

コンストラクター

UpdateFolderType()

コンストラクターは UpdateFolderType 、 クラスの新しいインスタンスを UpdateFolderType 初期化します。

プロパティ

FolderChanges

プロパティは FolderChanges 、一連のフォルダーに加えられた変更の配列を取得または設定します。 このプロパティは必須です。 これは、読み取り/書き込みプロパティです。

適用対象