Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with SearchControls object with regards to LDAP

Status
Not open for further replies.

thelordoftherings

Programmer
May 16, 2004
616
IL
Hello,

I am using a SearchControls object in order to search in my LDAP.
I would like to get our departments inside the organization. For that I need only the OUs without the users inside them. The problem is this:
Assume controls is of type SearchControls.
When I use:
controls.setSearchScope(SearchControls.SUBTREE_SCOPE);
I receive a list with the whole users but when I use:
controls.setSearchScope(SearchControls.ONELEVEL_SCOPE);
I receive nothing.
Why is that and how do I solve it?
 
10X Dian, I am familiar with these arcticles.
The problem is that SUBTREE_SCOPE Starts at the base entry; searches the base entry and everything below it. This is not good for me since it will bring the whole users inside the OU which I don't need and is very heavy.
On the other hand, ONELEVEL_SCOPE Searches only the entries below the base entry. This is not good as well since I won't get nested OU's...

What I need is the information just about my OU's, not the users inside them. I need this to get a list of all the departments in our organization and if inside OU A there are 200 users + another OU B which has 200 users inside it as well, all I need from the results is to retreive me OU A and OU B from them I will fetch the necessary data.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top