ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Communication / LDAP functions
  • LDAP filter
  • Examples of filters
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
LDAPFind (Function)
In french: LDAPRecherche
Performs a search in an LDAP server. The search is performed recursively. You also have the ability to use LDAPListChildren.
Example
// Tous les noms commençant par s et w
sCritère1 is string = "(|(displayname=s*)(displayname=w*))"

// Tous les noms ressemblant à kurd
sCritère2 is string = "(displayname~=kurd)" 

// Tous ceux qui ont un givenname sauf Mark
sCritère3 is string = "(&(givenname=*)(!givenname=Mark))" 

sRésultatRecherche = LDAPFind("MaSession", FEN_FenPrem.SAI_DNBASE, sCritère1) 
gsListeRecherche += sRésultatRecherche + CR

sRésultatRecherche = LDAPFind("MaSession", FEN_FenPrem.SAI_DNBASE, sCritère2) 
gsListeRecherche += sRésultatRecherche + CR

sRésultatRecherche = LDAPFind("MaSession", FEN_FenPrem.SAI_DNBASE, sCritère3) 
gsListeRecherche += sRésultatRecherche + CR
Syntax
<Result> = LDAPFind(<LDAP session> , <DN of base object> , <Search criterion>)
<Result>: Character string
  • List of distinguished names (DN) for the objects found. The different elements are separated by "CR" characters (Carriage Return).
  • Empty string ("") if no object corresponding to the search was found.
    If an error occurs, <Result> corresponds to an empty string ("") and the ErrorOccurred variable is set to True. ErrorInfo returns more details about the error.
<LDAP session>: Character string
Name of LDAP session used.
<DN of base object>: Character string
Distinguished Name (DN) of object from which the search is performed.
<Search criterion>: Character string
LDAP filter that will be applied to the search. For more details, see remarks.
Remarks

LDAP filter

The search filter uses the syntax of LDAP search filters. These filters can use one of the following syntaxes:
  • (<Attribute><Operator><Value>)
  • (<Operator><Filter1><Filter2>)
In these syntaxes:
  • <Attribute> corresponds to the name of an LDAP attribute.
  • <Operator> can take one of the following values:
    • =: Equality
    • ~= Approximation
    • <=: Less than or equal
    • >=: Greater than or equal
    • &: AND
    • |: OR
    • !: NO
  • <Value> corresponds to the sought value. The "*" character is allowed.
    If special characters must be used in the search filter, these characters must be replaced with the corresponding sequence:
    • * character: \2a
    • Character (: \28
    • Character ): \29
    • Character \: \5c
    • Character NULL: \00
    • Character /: \2f
  • <Filter1> is a filter in the following format: (<Attribute><Operator><Value>)
  • <Filter2> is a filter in the following format: (<Attribute><Operator><Value>)

Examples of filters

"(objectClass=*)"Filters all the objects
"(&(objectCategory=person)(objectClass=user)(!cn=andy))"Filters all the users except "andy"
"(sn=sm*)"Filters the objects whose 'sn' starts with 'sm'
"(&(objectCategory=person)(objectClass=contact)(|(sn=Smith)(sn=Johnson)))"Filters all the contacts whose 'sn' is 'Smith' or 'Johnson'
Component: wd300com.dll
See also
Minimum version required
  • Version 10
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 03/27/2025

Send a report | Local help