Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Beware: Newbie Question!....querying an LDAP server

Status
Not open for further replies.

awolff01

Programmer
Jun 17, 2003
55
US
Hello. I have been tasked with building a program to query an LDAP server to get information about users.

Basically all I know is this about the users:
CN=John Smith/OU=SLF/O=MYCOMPANY

1. Is this feasible what I am being asked to do?
2. What is the format for querying an LDAP server?
3. Can it be done thru a web-browser?

I will probably need to write the program in VB or VBA perhaps PERL.

Thank You.


Alex-
 
If you are looking for a phonebook, I already have the pages written (and in use).
Here is one of the pages:

<%@ Language=VBScript %>
<%
Option Explicit
Dim con,rs,Com,letter,school
%>
<html>
<head>
<style>
.over { background-color: #FFFF66; cursor: hand}
.out { background-color: #CCCCCC}
</style>
</head>
<body topmargin=&quot;0&quot; leftmargin=&quot;0&quot; bgcolor=&quot;#CCCCCC&quot; >
<%
letter = request.queryString(&quot;letter&quot;)
school = request.queryString(&quot;school&quot;)
If letter <> &quot;&quot; Then
Set con = Server.CreateObject(&quot;ADODB.Connection&quot;)
con.provider =&quot;ADsDSOObject&quot;
con.Properties(&quot;User ID&quot;)=&quot;burlington\fwstudent&quot;
con.Properties(&quot;Password&quot;)=&quot;&quot;
con.Properties(&quot;Encrypt Password&quot;)=True
con.open &quot;Active Directory Provider&quot;
Set Com = CreateObject(&quot;ADODB.Command&quot;)
Set Com.ActiveConnection = con
Com.CommandText =&quot;select name, sAMAccountname from 'LDAP://hs_inst.burlington.org/OU=Staff,OU=Domain Users,DC=burlington,DC=org' WHERE objectCategory='person' AND department='&quot;+school+&quot;' AND sn='&quot;+letter+&quot;*' ORDER BY name&quot;
Set rs = Com.Execute
%>
<table border=&quot;0&quot; cellpadding=&quot;0&quot; bgcolor=&quot;#CCCCCC&quot;>
<%
Do While Not rs.EOF
%>
<tr><td onMouseOver=&quot;this.className='over'&quot; onMouseOut=&quot;this.className='out'&quot; class=&quot;out&quot; valign=&quot;middle&quot; onclick=&quot;window.open('info.asp?user=<% response.write rs(&quot;sAMAccountname&quot;)%>','InfoFrame');window.open('emailstart.htm','EmailFrame');&quot;><a><b><font color=&quot;#000080&quot; face=&quot;Verdana&quot; size=&quot;2&quot;>
<% response.write rs(&quot;Name&quot;)%></font></b></a></td>
</tr>
<%
rs.MoveNext
Loop
rs.Close
%>
</table>
<%
con.Close
Set rs = Nothing
Set con = Nothing
End If
%>
</body>
</html>

You can take a look at it at:
and click the search button
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top