Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get all the groups assigned to a user from AD

Puneet pun
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am trying to get list of groups assigned to the user from AD. I have tested a query in AD tool and it seems to be working but not when triggered via the code.

Any pointers??

LDAP query worked from AD tool:

Through code:

String searchFilter = "(&(objectClass=group)(member=CN=test,OU=People,DC=corp,DC=XXX,DC=org))"
String searchBase = "DC=XXX,DC=org";

SearchControls searchCtls = new SearchControls();
NamingEnumeration answer =, searchFilter, searchCtls);

Its not returning any result and is getting timed out.

Also , we dont have memberOf attribute in the user attributes.


  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic