다음을 통해 공유


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)

Syntax

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

Inheritance Hierarchy

System.Object
   ExchangeWebServices.BaseRequestType
     ExchangeWebServices.BaseDelegateType
      ExchangeWebServices.GetDelegateType

Example

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 = "user1@example.com";
    request.IncludePermissions = true;

    try
    {
        // Send the GetDelegate request and get the response.
        GetDelegateResponseMessageType response = esb.GetDelegate(request);
        DelegateUserResponseMessageType[] durmt = new DelegateUserResponseMessageType[] { };
        if (response.ResponseMessages != null)
        {
            durmt = response.ResponseMessages;
        }
        else
        {
            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("=====================");
                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);
            }
            else
                Console.WriteLine("Warning: " + resp.MessageText);
        }

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

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)