This documentation is archived and is not being maintained.

Using Name Resolution in Exchange 2010

Last modified: May 21, 2009

Applies to: Exchange Server 2007 | Exchange Server 2010

You can use Exchange Web Services to resolve names against the Active Directory directory service and a user's contact folder.

The following example shows you how to resolve an ambiguous name. This example shows two possible resolutions for the given name.

static void ResolveNames(ExchangeServiceBinding esb)
    // Create the ResolveNamesType and set the unresolved entry.
    ResolveNamesType rnType = new ResolveNamesType();
    rnType.ReturnFullContactData = true;
    rnType.UnresolvedEntry = "Test";

    // Resolve names.
    ResolveNamesResponseType resolveNamesResponse = esb.ResolveNames(rnType);

    // Check the result.
    if (resolveNamesResponse.ResponseMessages.Items.Length > 0 &&
        resolveNamesResponse.ResponseMessages.Items[0].ResponseClass != ResponseClassType.Error)
        ResolveNamesResponseMessageType responseMessage = resolveNamesResponse.ResponseMessages.Items[0] as ResolveNamesResponseMessageType;
        // Display the resolution information.
        foreach (ResolutionType resolutionType in responseMessage.ResolutionSet.Resolution)
            Console.WriteLine("EmailAddress: " + resolutionType.Mailbox.EmailAddress);
            Console.WriteLine("Name: " + resolutionType.Mailbox.Name);
            Console.WriteLine("MailboxType: " + resolutionType.Mailbox.MailboxType.ToString());
            Console.WriteLine("RoutingType: " + resolutionType.Mailbox.RoutingType);
            if (resolutionType.Mailbox.ItemId != null)
               Console.WriteLine("ItemId Id:" + resolutionType.Mailbox.ItemId.Id);
               Console.WriteLine("ItemId ChangeKey:" + resolutionType.Mailbox.ItemId.ChangeKey);

The following XML example shows the XML request message that is sent from the client to the server.

<?xml version="1.0" encoding="utf-8"?>
<ResolveNames xmlns:xsi="" 
      <UnresolvedEntry xmlns="">Test</UnresolvedEntry>

The following XML example shows the XML response message that is sent from the server to the client.

<?xml version="1.0" encoding="utf-8"?>
<ResolveNamesResponse xmlns:xsi="" 
  <ResponseMessages xmlns="">
    <ResolveNamesResponseMessage ResponseClass="Success">
      <ResolutionSet IncludesLastItemInRange="true" 
        <Resolution xmlns="">
              <Entry Key="EmailAddress1"></Entry>

The SOAP messages that are passed between the Exchange Web Services client and server are defined by the XML schema and WSDL files. The XML schema and WSDL files define the contract between the client and server. Proxy class generators create an object-model abstraction of those SOAP messages, which can simplify programming. This code example uses a proxy class library that was generated by MicrosoftVisual Studio 2005. Different proxy class generators create different object models for a given Web service. This proxy class code example is an illustration only. Refer to the proxy class generator documentation for support for proxy classes.

For information about compiling the code, see EWS Client Development in Exchange 2010.