![]() ![]() ![]() |
The widespread use of the Lightweight Directory Access Protocol to build searchable directory structures, both internally and across the Web, provides ColdFusion developers with new opportunities to add value to the sites they create. Contact information or other data from an LDAP-accessible server can be indexed and searched by users. Remember to create the collection in the Administrator.
Two things to remember when creating an index from an LDAP query:
In the example below, the search criterion is records with a telephone number in the 617 area code. Generally, LDAP servers use the Distinguished Name (dn) attribute as the unique identifier for each record, so that is used as the KEY value for the index.
<!--- Run the LDAP query ---> <CFLDAP NAME="OrgList" SERVER="my.ldapserver.com" ACTION="query" ATTRIBUTES="o, telephonenumber, dn, mail" SCOPE="onelevel" FILTER="(|(O=a*) (O=b*))" SORT="o" START="c=US"> <!--- Output query result set ---> <CFOUTPUT QUERY="OrgList"> DN: #dn# <BR> O: #o# <BR> TELEPHONENUMBER: #telephonenumber# <BR> MAIL: #mail# <BR> =============================<BR> </CFOUTPUT> <!--- Index the result set ---> <CFINDEX ACTION="update" COLLECTION="ldap_query" KEY="dn" TYPE="custom" TITLE="o" QUERY="OrgList" BODY="telephonenumber"> <!--- Search the collection ---> <!--- Use the wildcard * to contain the search string ---> <CFSEARCH COLLECTION="ldap_query" NAME="s_ldap" CRITERIA="*617*"> <!--- Output returned records ---> <CFOUTPUT QUERY="s_ldap"> #Key#, #Title#, #Body# <BR> </CFOUTPUT>
![]() ![]() ![]() |
AllaireDoc@allaire.com
Copyright © 1998, Allaire Corporation. All rights reserved.