I'm trying to get all the email addresses associated to a given AD user.
For the user I have the domain and the login name (ex. DOMAIN\UserName) and I the AD is storing the email addresses in:
- The mail attribute.
- In
proxyAddresses
attributes.
So far, I don't know what C# API to use to connect to the AD, and how to properly filter by the user to fetch all the email addresses. I'm using .NET 3.5.
Thank you.
Here's a possible solution using various classes in the
System.DirectoryServices
namespace.Have you looked at the DirectoryEntry class. You can pull properties from there given you have the LDAP string set up. The propery for mail is "mail" ironic aint it ?