none
Exchange Web Service API - Contact Email Address RRS feed

  • Question

  • How do I get the normal formatted address from the exchange contact emailaddressentry dictionary object.  All I get is some other email format like this - {/o=Company/ou=Exchange Administrative Group (NHJUYHTGGG)/cn=Recipients/cn=Surname, GivenName261}
    Monday, June 17, 2013 6:38 PM

Answers

  • Hi Glen,

    Thanks for the reply.  Calling .Load() solved the problem, although I was hoping to avoid having to load the contact because if I understand, this causes another call to Exchange which is a performance hit.

    That being said, I am still working on another issue of getting the contact photo, so I think I am going to have to load the contact anyway.

    Thanks Again.

    • Marked as answer by Builder 66 Tuesday, June 18, 2013 3:13 PM
    Tuesday, June 18, 2013 3:13 PM

All replies

  • That's the X500\Native Address format which is always used for contacts that have been added from the GAL, All you need to do with the EWS Managed API to resolve this is use the Load Method on the Contact

    contact.Load();

    EWS should then hand you back the Resolved SMTP address in the same property, otherwise you can also use ResolveName method to resolve it separately.

                NameResolutionCollection nrCol = service.ResolveName(contact.EmailAddresses[EmailAddressKey.EmailAddress1].Address, ResolveNameSearchLocation.DirectoryOnly, true);
                foreach (NameResolution nr in nrCol)
                {
                    if (nr.Contact != null)
                    {
                        Console.WriteLine(nr.Mailbox.Address);
                    }
                }
    Cheers
    Glen
    Tuesday, June 18, 2013 6:25 AM
  • Hi Glen,

    Thanks for the reply.  Calling .Load() solved the problem, although I was hoping to avoid having to load the contact because if I understand, this causes another call to Exchange which is a performance hit.

    That being said, I am still working on another issue of getting the contact photo, so I think I am going to have to load the contact anyway.

    Thanks Again.

    • Marked as answer by Builder 66 Tuesday, June 18, 2013 3:13 PM
    Tuesday, June 18, 2013 3:13 PM