That's correct, even though the fields are optional, when some of the fields are populated fields all are required.
Could you explain what you mean by "you would need some logic to decide how to build the actual filter." Do you mean setting variables called filter below <cfset filter = "(&(objectClass=user)"> <cfset filter = filter & "(mail=#form.mail#)"> <cfset filter = filter & "(sn=#form.sn#)"> Etc...... Then in the ldap query in the filter field just have <cfldap action="query" ............... filter="#filter#" ............... .............. > ???? -----Original Message----- From: Dawson, Michael [mailto:[EMAIL PROTECTED] Sent: 02 February 2006 14:35 To: CF-Talk Subject: RE: Coldfusion and Active Directory Yes, this can be done with CF and LDAP. It seems that, even though some fields are optional, the fields that *are* populated are *all* required, right? If so, then you need an AND filter. So that means you can simply build a dynamic filter string like this: <cfset filter = "(&(objectClass=user)"> <cfset filter = filter & "([EMAIL PROTECTED])"> <cfset filter = filter & "(sn=MyLastName)"> <cfset filter = filter & ")"> Of course, you would need some logic to decide how to build the actual filter. This should work great for you. Just watch the nesting of the parenthesis. M!ke -----Original Message----- From: Ian Vaughan [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 01, 2006 2:42 AM To: CF-Talk Subject: RE: Coldfusion and Active Directory All the fields are optional. E.G. A user could fill in the name and e-mail fields on their first search and just the cn name field on their next search. That is the functionality that needs to be in the filter, just needed to know if this can be done with LDAP and Coldfusion ? -----Original Message----- From: Dawson, Michael [mailto:[EMAIL PROTECTED] Sent: 31 January 2006 16:45 To: CF-Talk Subject: RE: Coldfusion and Active Directory First, we need to know which fields are optional or required. I don't see anything wrong with this LDAP filter. It says: MUST BE objectClass = user AND sAMAccountName = form.sAMAccountName AND cn = form.cn AND title = form.title AND email = form.email For this filter to work, you must specify a valid value for each of these attributes of or you will not get any results. Are you sure you want to filter on the title? What if someone doesn't type the title correctly? You may need to use a wildcard in your filter and let them search for a partial match. If you have optional fields, then you would need to dynamically build your LDAP filter string and leave those fields out. M!ke -----Original Message----- From: Ian Vaughan [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 31, 2006 9:48 AM To: CF-Talk Subject: RE: Coldfusion and Active Directory I have a form to search the Active Diretory shown below, searching the account name, name, title, e-mail and telephone number attributes for an Intranet Phone Directory How can I modify the filter query of the CFLDAP statement to cater for this ? filter="(&(objectClass=user)(sAMAccountName=#Form.sAMAccountName#)(cn=#F orm.cn#)(title=#Form.title#)(email=#Form.email#))" I have tried using | instead of & but that just brings back all results ?? <cfform method="POST" action="cfldap1.cfm" name="form"> <cfinput type="text" name="sAMAccountName" size=22 ><br> <cfinput type="text" name="cn" size=22 ><br> <cfinput type="text" name="title" size=22 ><br> <cfinput type="text" name="email" size=22 ><br> <input type="image" src="search.gif" border="0" style="cursor:hand" width="49" height="18"> </cfform> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:231109 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

