CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 Pop-up for Email address lookup

Print topic Send  topic

Author Message
RoyBaird

Posts: 115
Posted: 07/24/2005, 9:42 PM

Here is a tried and true VBscript that will return email address based on the partial name entered. I need to get this to populate a listbox in a pop-up page so the selected value can be passed back to the main page. I.E. User enters a partial name and all of the email address that match will be shown.

Option Explicit

Dim objCommand, objConnection, strBase, strFilter, strAttributes

Dim strQuery, objRecordset, strName, strCN



Set objCommand = CreateObject("ADODB.Command")
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
objCommand.ActiveConnection = objConnection
strBase = "<LDAP://dc=domain,dc=com>" '***** this is where you put your domain ****

strFilter = "(&(objectCategory=person)(objectClass=user)(cn=*baird*))" '**** cn needs to be a user entered variable for the name to search for ****
strAttributes = "sAMAccountName,cn"
strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
objCommand.CommandText = strQuery
objCommand.Properties("Page Size") = 100
objCommand.Properties("Timeout") = 30
objCommand.Properties("Cache Results") = False
Set objRecordSet = objCommand.Execute

Do Until objRecordSet.EOF
strName = objRecordSet.Fields("sAMAccountName").Value

strCN = objRecordSet.Fields("cn").value

Document.Write "NT Name: " & strName & ", Common Name: " & strCN '**** this is the data I need in a list box *****
objRecordSet.MoveNext
Loop



objConnection.Close

_________________
Roy
View profile  Send private message
Nicole

Posts: 586
Posted: 07/25/2005, 6:16 AM

Roy,
CCS Example Pack 2 solution includes good example of look up fields on a fly. You can check it at http://examples.codecharge.com/CCSExamplePack2/Retrievi...ieldsValues.php

_________________
Regards,
Nicole
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.