Getting All The Attributes Of An Entry; Example: Querying An Ldap Directory - MACROMEDIA COLDFUSION MX 61-DEVELOPING COLDFUSION MX Develop Manual

Developing coldfusion mx applications
Table of Contents

Advertisement

If you use filter operators to construct sophisticated search criteria, performance might degrade
if the LDAP server is slow to process the synchronous search routines that
You can use the
performance of pages that perform queries, by limiting the number of entries and by exiting
the query if the server does not respond in a specified time.

Getting all the attributes of an entry

Typically, you do not use a query that gets all the attributes in an entry. Such a query would return
attributes that are used only by the directory server. However, you can get all the attributes by
specifying attributes="*" in your query.
If you do this, ColdFusion returns the results in a structure in which each element contains a
single attribute name-value pair. The tag does not return a query object. ColdFusion does this
because LDAP directory entries, unlike the rows in a relational table, vary depending on their
object class.
For example, the following code retrieves the contents of the Airius directory:
<cfldap name="GetList"
server=#myServer#
action="query"
attributes="*"
scope="subtree"
start="o=airius.com"
sort="sn,cn">
This tag returns entries for all the people in the organization and entries for all the groups. The
group entries have a different object class, and therefore different attributes from the person
entries. If ColdFusion returned both types of entries in one query object, some rows would have
only the group-specific attribute values and the other rows would have only person-specific
attribute values. Instead, ColdFusion returns a structure in which each attribute is an entry.

Example: querying an LDAP directory

The following example uses the
corporation's Santa Clara office. Users can enter all or part of a person's name and get a list of
matching names with their departments, e-mail addresses, and telephone numbers.
This example uses the sample Airius corporate directory that is distributed with the Netscape
Directory Server. If you do not have access to this directory, modify the code to work with your
LDAP directory.
To query an LDAP directory:
Create a file that looks like the following:
1
<!--- This example shows the use of CFLDAP --->
<html>
<head> <title>cfldap Query Example</title> </head>
<h3>cfldap Query Example</h3>
<body>
<p>This tool queries the Airius.com database to locate all people in
the company's Santa Clara office whose common names contain the
text entered in the form.</p>
tag
and
cfldap
timeout
tag to get information about the people in the Airius
cfldap
attributes to control the apparent
maxRows
Querying an LDAP directory
supports.
cfldap
485

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the COLDFUSION MX 61-DEVELOPING COLDFUSION MX and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

This manual is also suitable for:

Coldfusion mx

Table of Contents