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.
Windows Server 2003

Avatar of undefined
Last Comment
harperse

8/22/2022 - Mon
harperse

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
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))
harperse

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
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
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
harperse

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question