Click here to Skip to main content
15,885,914 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I connect to ldap server with c#. I want search by propertie- (telephoneNumber=*). But if i insert it to code program show me error.

This code work perfect.

C#
DirectoryEntry searchRoot = null;
            searchRoot = new DirectoryEntry("LDAP://OU=OrgUnit,DC=dgp,DC=hexl,DC=ru");
            DirectorySearcher search = new DirectorySearcher(searchRoot);
            search.Filter = "(&(objectCategory=*)(objectClass=user)))";
           

             SearchResult result;
             SearchResultCollection resultCol = search.FindAll();
            if (resultCol != null)
            {
                for (int counter = 0; counter < resultCol.Count; counter++)
                {
                     result = resultCol[counter];
                }
            }


But i cannot understand make this search query
C#
(&(objectCategory=*)(objectClass=user)(telephoneNumber="222")))
Posted

1 solution

Try Application Login through Active Directory (LDAP)[^] and read "Listing the Details of a User"..
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900