Public ldapsearchresults searchldapsearchresults (string basedn) {ldapsearchconstraintsobject (); try {If (ldapconf. log. equals ("yes") {log.info ("start to get data .. ");} ldaprsults = LC. search (basedn, ldapconnection. scope_sub, "(& (objectclass = person )(! (Useraccountcontrol = 514) (Mail = *) ", new string [] {" telephonenumber "," cn "," displayname "," company "," mailnickname ", "Mail", "mobile", "Sn", "department", "userprincipalname", "streetaddress"}, false, LSC);} catch (ldapexception E) {log.info ("failed to get data .. "); log.info (e); E. printstacktrace ();} return ldaprsults ;}
& |
And (all items in the list must be true) |
| |
Or (at least one in the list must be true) |
! |
Non (the reverse item cannot be true) |
= |
Equal (matching rules based on attributes) |
~ = |
Approximate equals (matching rules based on attributes) |
> = |
Greater than (matching rules based on attributes) |
<= |
Less than (matching rules based on attributes) |
= * |
Yes (this attribute must exist in the entry, but the value is not limited) |
* |
Wildcard (indicating that this location can contain one or more characters), used when specifying the attribute value |
\ |
Escape Character (escape when "*", "(", ")" is encountered) |
Excerpt Conditions
The following filter searches for entries that contain one or more manager attribute values. This is also called an existing search: Manager = *
The following filter searches for entries that contain the generic name Ray kultgen. This is also called equivalent search: Cn = Ray kultgen
The following filters return all entries that do not contain the generic name Ray kultgen :(! (CN = Ray kultgen ))
All entries returned by the following filter contain the description attribute of the sub-string X.500: Description = * X.500 *
The following filter returns all entries whose organizational unit is marketing and the description field does not contain the sub-string X.500: (& (ou = Marketing )(! (Description = * X.500 *)))
The following filter returns all entries whose organizational unit is marketing and whose manager is Julie fulmer or Cindy zwaska: (& (ou = Marketing) (| (Manager = Cn = Julie fulmer, ou = marketing, dc = siroe, Dc = com) (Manager = Cn = Cindy zwaska, ou = marketing, Dc = siroe, Dc = com )))
The following filters return all entries that do not represent a person :(! (Objectclass = person ))
The following filter returns all entries that do not represent a person and have a common name similar to printer3b :(&(! (Objectclass = person) (CN ~ = Printer3b ))
LDAP filter conditions and search for specified attributes