This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

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
Boost this thread!