0

I am facing some difficulties while listing all the users in more than two groups in the Active Directory. I can list the members who are in one group by specifing the OU (ex. IT) and the DC

Here is my code

 public static String usersContainer = "ou=USERS,ou=IT,ou=Accounts,ou=HR,ou=AAB,dc=AXA";

If I want to include the account at the same time and they are also ou, how do I do that?

I tried this solution:

ou=USERS,ou=IT,ou=account,dc=XXX,dc=AAA,dc=com

But, it gave me an error that the name is not found. How do I include one more ou at the same level of the first ou

The rest of my code is

        ctls.setSearchScope(SearchControls.SUBTREE_SCOPE);
        NamingEnumeration answer = ctx1.search(usersContainer, "(objectClass=user)", ctls);

Can anyone help

Terry Gardner
  • 10,957
  • 2
  • 28
  • 38
user1080320
  • 243
  • 7
  • 11
  • 18
  • Can you give your code and you filter, but it can be a duplicate of : [LDAP root query syntax to search more than one specific OU](http://stackoverflow.com/q/9184978/608772) – JPBlanc Feb 21 '12 at 12:40
  • Do you man in my public usersContainer to modify it to public static String usersContainer = "ou=USERS,(|(ou=IT)(ou=Accounts)(ou=HR),ou=AAB,dc=AXA";Is it correct? – user1080320 Feb 21 '12 at 16:50
  • I tried the above solution, but it did not work for me public static String usersContainer = "ou=USERS,(|(ou=IT)(ou=Accounts)(ou=HR),ou=AAB,dc=AXA"; – user1080320 Feb 22 '12 at 06:37

0 Answers0