Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / C#

Accessing Active Directory Objects via C# (Visual Studio)

0.00/5 (No votes)
22 Feb 2011CPOL 7.8K  
Hi,How to list all users in ListBox include cn, mobile, mail?private void Form1_Load(object sender, EventArgs e){ DirectoryEntry dir = new DirectoryEntry(LDAP://ou=o,DC=xyz,DC=de); DirectorySearcher search = new DirectorySearcher(dir); search.Filter =...
Hi,

How to list all users in ListBox include cn, mobile, mail?

private void Form1_Load(object sender, EventArgs e)
{
    DirectoryEntry dir = new DirectoryEntry("LDAP://ou=o,DC=xyz,DC=de");
    DirectorySearcher search = new DirectorySearcher(dir);
    search.Filter = "(&(objectClass=user))"; // (mobile=+44*))";
    search.SearchScope = SearchScope.Subtree;
    SearchResultCollection searchresult = search.FindAll();
    if (searchresult != null)
{
    ???
}


Regards

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)