Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Whats is this format called? "/o=First Organization/ou=First Administrative Group/cn=Recipients/cn=user"

What format is the following string called in regards to Microsoft Exchange?

/o=First Organization/ou=First Administrative Group/cn=Recipients/cn=user

I've seen this using LDAP, but now seeing it CDO 1.2.1 and ultimately trying to convert it to an email address like [email protected]. Thanks.

like image 472
Chad Harrison Avatar asked Sep 09 '11 14:09

Chad Harrison


2 Answers

It's called legacy Exchange distinguished name and is a remnant from Exchange 5.5.

You can either resolve this address using the ResolveNames method (http://msdn.microsoft.com/en-us/library/exchangewebservices.exchangeservicebinding.resolvenames(v=exchg.140).aspx) of the EWS Managed API, call the EWS WebService method ResolveName directly.

Another option is to use LDAP and search for the user object with the property legacyExchangeDN set to your address. Then, query the proxyAddress attribute and retrieve the one address which is prefixed with "SMTP:" (all uppercase).

like image 113
Henning Krause Avatar answered Sep 24 '22 10:09

Henning Krause


The method Henning's link is deprecated with Exchange 2013.

Now the recommended way is to do it through ExchangeService.ResolveName() and retrieve the STMP address from the Mailbox property.

public string ResolveToSmtpAddress(string address)
{
    try
    {
        NameResolutionCollection nrc = _service.ResolveName(address);

        foreach (var add in nrc)
        {
            return add.Mailbox.Address;
        }
        return null;
    }
    catch (Exception)
    {
        throw;
    }
}
like image 32
Amicable Avatar answered Sep 22 '22 10:09

Amicable