Link to home
Start Free TrialLog in
Avatar of shawit
shawit

asked on

Can I display the results of an LDAP query in HTML format?

I have a couple hundred Query Based Distribution Groups and users are constantly wanting to know who the members of those groups are.

What I want to do, is copy the LDAP query from each QBDG and somehow make it available on our intranet (using sharepoint) so users can click on the link and see a real time list of who exactly is in the groups.

Is this possible?  It seems like it has to be, but I can't put my finger on it.

Thanks.
Avatar of harperse
harperse
Flag of United States of America image

shawit,

Post your LDAP query code, and someone will probably be nice enough to wrap it in ASP or HTML if you ask nicely.  ;)

Best of luck,
harperse
Avatar of shawit
shawit

ASKER

harperse,

Here's the LDAP query...Thanks for the suggestion...I really appreciate it!  I don't know squat about ASP or HTML...

Thanks!

(&(objectCategory=user)(extensionAttribute5=CO2)(extensionAttribute7=*550))
Here is some rough code for you:
1.  Replace the "strLDAP = " line with your domain information
2.  The "strLDAPQuery2" line is your query...replace or augment as needed

--------------------------------------------------------------------------------------
<%@ LANGUAGE="VBSCRIPT" %>
<HTML>
<HEAD>
<TITLE>Document Title</TITLE>
</HEAD>
<BODY>

<%
Dim strLDAP, strLDAPQuery1, strLDAPQuery2, objADO, objRecordSet

strLDAP = "dc=dc1,dc=domain,dc=com"
strLDAPQuery1 = "<LDAP://" & strLDAP & ">;"
strLDAPQuery2 = "(&(objectCategory=user)(extensionAttribute5=CO2)(extensionAttribute7=*550))"

strLDAPQuery = strLDAPQuery1 & strLDAPQuery2

Response.Write "<b>Query Results for " & StrLDAPQuery & ":</b><hr>"

Set objADO = CreateObject("ADODB.Connection")
objADO.Provider = "ADsDSOObject"
objADO.Open ""

Set objRecordset = objADO.Execute (strLDAPQuery)
objRecordSet.MoveFirst

While Not objRecordSet.EOF
      Response.Write objRecordSet.Fields("Name")
      objRecordset.MoveNext
Wend
%>
</BODY>
</HTML>
--------------------------------------------------------------------------------------
Best of luck,
harperse
Avatar of shawit

ASKER

Harperse,

Thanks for that information.  I think we are certainly on the right track.

I pasted this into notepad, made the change to reflect our domain name, and saved it as test.html

When I open it in IE it just shows me a blank screen though, and this is after I manually tell it to allow "blocked content" to run.

Any ideas?

Thanks again!
ASKER CERTIFIED SOLUTION
Avatar of harperse
harperse
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial