none
EmailAddress class when contact is from active directory RRS feed

  • Question

  • Hi,

    I create a smal programa that gets all contacts from a mail box and get the email string from there. But some contacts (imported from AD) in EmailAddresses field don´t have email.

    Here the code:

     public static bool HasEmails(Microsoft.Exchange.WebServices.Data.Contact contacto, out List<string> emails)
            {
                emails = new List<string>();
    
                EmailAddress email = null;
    
                contacto.EmailAddresses.TryGetValue(EmailAddressKey.EmailAddress1, out email);
    
                if (email != null)
                {
                    emails.Add(email.Address);
                    email = null;
                }
    }

    Some times return me not an email address but an AD string like this: '/o=TES/ou=first administrative group/cn=Recipients/cn=POK'

    I need to lookup to AD to get the email adress string?

    Thanks

    Tuesday, May 27, 2014 1:47 PM

Answers

  • HI

    In AD, you can look at Proxy attribute which will have all the Email address assigned to a single mailbox or Mail attribute which is manually addedd while creating a user

    • Marked as answer by Rockxl1 Friday, June 20, 2014 2:57 PM
    Tuesday, May 27, 2014 3:16 PM

All replies

  • HI

    In AD, you can look at Proxy attribute which will have all the Email address assigned to a single mailbox or Mail attribute which is manually addedd while creating a user

    • Marked as answer by Rockxl1 Friday, June 20, 2014 2:57 PM
    Tuesday, May 27, 2014 3:16 PM
  • What does the code you use look like to get the Contacts ? One workaround is if you are only getting the X500 address eg  '/o=TES/ou=first administrative group/cn=Recipients/cn=POK' is that you can use ResolveName http://msdn.microsoft.com/en-us/library/office/gg274399(v=exchg.80).aspx to resolve the X500 address to the SMTP address for that mailbox or contacts (as long as they are still a valid GAL entry).

    Cheers
    Glen

    Wednesday, May 28, 2014 2:20 AM