• Post Reply Bookmark Topic Watch Topic
  • New Topic

ActiveDirectory search problem  RSS feed

 
John Eric Hamacher
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello:

I am trying to search for a CN given a sAMAccountName but having no luck getting results. Does anybody have a suggestion?


Attributes matchAttrs = new BasicAttributes(true);
matchAttrs.put(new BasicAttribute("sAMAccountName", "jblow@jblow.com"));
NamingEnumeration answer = ctx.search("ou=People,dc=aa,dc=bb",matchAttrs);

while (answer.hasMore()) {
SearchResult sr = (SearchResult)answer.next();
System.out.println(">>>" + sr.getName());
printAttrs(sr.getAttributes());
}
 
Vilmantas Baranauskas
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does "objectcalss=*" work fine for you?
 
Vilmantas Baranauskas
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may also want to try using other search method and pass following SearchControls:

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!