CFLDAP allows you to search an LDAP directory and output the results of your query on a page. You can sort query results and return them to the browser or perform further processing with CFOUTPUT, CFREPORT, and related tags.
A search string of the form attribute operator value defines the filter syntax. The default filter, objectclass=*, returns all entries for the attribute.
The following table lists the filter operators. Note the prefix notation for the Boolean operators.
CFLDAP Filter Operators | |
---|---|
Operator | Example |
= | o=allaire - organization name equals allaire |
~= | o~=alliare - organization name approximates allaire |
>= | st>=ma - names appearing after "ma" in an alphabetical state attribute list |
<= | st<=ma - names appearing before "ma" in an alphabetical state attribute list |
* | o=alla* - organization names starting with "alla" o=*aire - organization names ending with "aire" o=all*aire - organization names starting with "all and " ending with "aire" |
& | (&(o=allaire)(co=usa)) - organization name = "allaire" AND country = "usa" |
| | (|(o=allaire)(sn=allaire)) - organization name = "allaire" OR surname = "allaire" |
! | (!(STREET=*)) - all entries that do NOT contain a StreetAddress attribute |
Although sophisticated search criteria can be constructed from these filter operators, performance may degrade if the LDAP server is slow to process the synchronous search routines supported by CFLDAP. The TIMEOUT and MAXROWS attributes can be used to control query performance.
The following uses CFLDAP to retrieve the name and telephone numbers for US organizations with a common name that starts with 'A' through 'E'. The search starts in the country: US. The filter is a regular expression that limits the search to expressions of any length that begin with "A," "B," "C," "D," or "E."
![]() |
To query an LDAP directory: |
<CFLDAP NAME="OrgList" SERVER="ldap.itd.umich.edu" ACTION="QUERY" ATTRIBUTES="o,st,telephoneNumber" SCOPE="ONELEVEL" FILTER="(|(o=A*)(o=B*)(o=C*)(o=D*)(o=E*))" MAXROWS=200 SORT="o" START="c=US"> <HTML> <HEAD> <TITLE>LDAP Directory Example</TITLE> </HEAD> <BODY> <H3>US Organizations beginning with the letter 'A' thru 'E':</H3> <CFFORM NAME="GridForm" ACTION="org_query.cfm"> <CFGRID NAME="grid_one" QUERY="OrgList" HEIGHT=250 WIDTH=620 HSPACE=20 VSPACE="6"> <CFGRIDCOLUMN NAME="o" HEADER="Organization" WIDTH=380> <CFGRIDCOLUMN NAME="st" HEADER="State" WIDTH=100> <CFGRIDCOLUMN NAME="telephoneNumber" HEADER="Phone ##" WIDTH=150> </CFGRID> </CFFORM> </BODY> </HTML>
ldapadd.cfm
and view it in your browser.