aspose file tools*
The moose likes Java in General and the fly likes Need help in filter syntax for LDAP search Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Need help in filter syntax for LDAP search" Watch "Need help in filter syntax for LDAP search" New topic
Author

Need help in filter syntax for LDAP search

Andrew Carney
Ranch Hand

Joined: Oct 17, 2006
Posts: 96
Hello,

I am using this query to get the OUs below a certain OU location from my LDAP:

String filter = "(&(description=*)(objectCategory=organizationalUnit))";
NamingEnumeration results = ctx.search(distinguishedName, filter, controls);

The method which runs this search receives the distinguishedName as a parameter. This distinguishedName specifies from which place to start the search.
The problem is that I receive all the OUs below the OU stated at the distinguishedName but I also receive the OU of the distinguishedName itself.
I would like to remove this OU from the results and for that I assume I need to add to the filter a requirement that distinguishedName != to the distinguishedName I receive as parameter. I tried few variations of the condition yet with no success. Can someone please help me correct this filter so it will match my requirement ?

Thank you in advance.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need help in filter syntax for LDAP search