RemoveDelegateType クラス

定義

クラスは RemoveDelegateType 、メールボックスからデリゲートを削除する要求を表します。

public ref class RemoveDelegateType : ExchangeWebServices::BaseDelegateType
public class RemoveDelegateType : ExchangeWebServices.BaseDelegateType
Public Class RemoveDelegateType
Inherits BaseDelegateType
継承

次の例では、user1 のメールボックスから 2 つのデリゲートを削除する方法を示します。 この例では、デリゲートのプライマリ簡易メール転送プロトコル (SMTP) アドレスを使用して 1 つのデリゲートが削除され、もう 1 つはデリゲートのセキュリティ識別子 (SID) を使用して削除されます。

static void RemoveDelegate()
{
    // Set the version, credentials, and the Client Access server on ExchangeServiceBinding.
    ExchangeServiceBinding esb = new ExchangeServiceBinding();
    esb.RequestServerVersionValue = new RequestServerVersion();
    esb.RequestServerVersionValue.Version = ExchangeVersionType.Exchange2007_SP1;
    esb.Credentials = new NetworkCredential("username", "password", "domain");
    esb.Url = "https://FQDN/ews/exchange.asmx";

    // Identify the delegates to be removed.
    UserIdType delegateUser1 = new UserIdType();
    UserIdType delegateUser2 = new UserIdType();
    delegateUser1.PrimarySmtpAddress = "user2@example.com";
    delegateUser2.SID = "S-1-5-21-1333220396-2200287332-232816053-1123";
    UserIdType[] delegateUsers = new UserIdType[2] { delegateUser1, delegateUser2 };

    // Form the RemoveDelegate request.
    RemoveDelegateType request = new RemoveDelegateType();
    request.Mailbox = new EmailAddressType();
    request.Mailbox.EmailAddress = "user1@example.com";
    request.UserIds = delegateUsers;

    try
    {
        // Send the RemoveDelegate request and get the response.
        RemoveDelegateResponseMessageType response = esb.RemoveDelegate(request);
        DelegateUserResponseMessageType[] durmt = new DelegateUserResponseMessageType[] { };
        durmt = response.ResponseMessages;

        // Check each response message.
        foreach (DelegateUserResponseMessageType resp in durmt)
        {
            if (resp.ResponseClass == ResponseClassType.Success)
            {
                Console.WriteLine("Delegate user was removed.");
            }
            else if (resp.ResponseClass == ResponseClassType.Error)
            {
                Console.WriteLine("Delegate user was not removed, due to error: " + resp.MessageText);
            }
            else
            {
                Console.WriteLine("Warning: " + resp.MessageText);
            }
        }
        Console.ReadLine();
    }
    catch (Exception e)
    {
        Console.WriteLine(e.Message);
        Console.ReadLine();
    }
}

コンストラクター

RemoveDelegateType()

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

プロパティ

Mailbox

プロパティは Mailbox 、メールが有効な EmailAddressType Active Directory ディレクトリ サービス オブジェクトを表す オブジェクトを取得または設定します。

(継承元 BaseDelegateType)
UserIds

プロパティは UserIdsUserIdType メールボックスから削除するデリゲートを表す配列を取得または設定します。

適用対象