Also, watch out for possible legal values that users pass in. They can enter:
username domain\username domain/username usern...@domain.com You will need to strip off anything that is not the username before you use it in your CFLDAP filter, if you are filtering on sAMAccountName. If they type usern...@domain.com, you can filter on userPrincipalName. However, I usually just strip everything except the username. Mike -----Original Message----- From: Ian Vaughan [mailto:i.vaug...@neath-porttalbot.gov.uk] Sent: Monday, January 12, 2009 9:34 AM To: cf-talk Subject: Active Directory - Getting a users Accountname Hi How do you query a logged in domain users networkID/accountname via Coldfusion. I would like CF to pick up automatically a users domain networkID and then set this as a variable to query against another database, although at the moment I am using a CFDUMP just to see the result. This is what I have at the moment, and I am getting the error below "Variable SAMACCOUNTNAME is undefined." Any ideas? ----CODE SNIPPET----------- <cfset StartOU="dc=domain, dc=co,dc=uk"> <cfldap action="query" name="adresult" attributes = "sAMAccountName,dn, cn,sn,givenName,password, mail,ou" start="#StartOU#" scope="subtree" filter="samaccountName=#samaccountName#" server="server" port="389" username="username" password="password" > </head> <body> <cfdump var="#sAMAccountName#"> ----------------------- Regards, Ian ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:317770 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4