This documentation is archived and is not being maintained.

GetDelegateType Class

The GetDelegateType class represents a request to get delegate settings for a mailbox in the Exchange database.

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

<SerializableAttribute> _
Public Class GetDelegateType _
	Inherits BaseDelegateType
Dim instance As GetDelegateType

The following example shows you how to retrieve the delegate settings for all the delegates that are set on user1's mailbox. All the permissions for each user are returned in the response.

static void GetDelegate()
    // 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";

    // Create the request.
    GetDelegateType request = new GetDelegateType();

    // Identify the mailbox for which to retrieve delegate settings.
    request.Mailbox = new EmailAddressType();
    request.Mailbox.EmailAddress = "";
    request.IncludePermissions = true;

        // Send the GetDelegate request and get the response.
        GetDelegateResponseMessageType response = esb.GetDelegate(request);
        DelegateUserResponseMessageType[] durmt = new DelegateUserResponseMessageType[] { };
        if (response.ResponseMessages != null)
            durmt = response.ResponseMessages;
            Console.WriteLine("There are no delegates for " + request.Mailbox.EmailAddress);

        // Check each response message.
        foreach (DelegateUserResponseMessageType resp in durmt)
            if (resp.ResponseClass == ResponseClassType.Success)
                DelegateUserType dut = resp.DelegateUser;
                Console.WriteLine("Delegate user's display name: " + dut.UserId.DisplayName);
                Console.WriteLine("Primary SMTP address: " + dut.UserId.PrimarySmtpAddress);
                Console.WriteLine("Calendar folder permission level: " + dut.DelegatePermissions.CalendarFolderPermissionLevel.ToString());
                Console.WriteLine("Contacts folder permission level: " + dut.DelegatePermissions.ContactsFolderPermissionLevel.ToString());
                Console.WriteLine("Journal folder permission level: " + dut.DelegatePermissions.JournalFolderPermissionLevel.ToString());
                Console.WriteLine("Delegate user receives copies of meeting messages? " + dut.ReceiveCopiesOfMeetingMessages.ToString());
                Console.WriteLine("Delegate user can view private items? " + dut.ViewPrivateItems);
            else if (resp.ResponseClass == ResponseClassType.Error)
                Console.WriteLine("Error: " + resp.MessageText);
                Console.WriteLine("Warning: " + resp.MessageText);

        //Identify who receives meeting requests.
        Console.WriteLine("Meeting requests are delivered to: " + response.DeliverMeetingRequests.ToString());
    catch (Exception e)

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