Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 LDAP

Author  Topic 

SamC
White Water Yakist

3467 Posts

Posted - 2002-09-06 : 11:02:34
Information on LDAP seems to be pretty obscure judging by how much is posted here and elsewhere on the net.

I've got a requirement to query an LDAP database using email as the key, retrieving name and organization if the email exists.

I need pointers to HOW TO if anyone has any.

Any info on how to hide the LDAP from my ASP pages in a manner discussed briefly in

http://sqlteam.com/Forums/topic.asp?TOPIC_ID=10425

SamC

jasper_smith
SQL Server MVP & SQLTeam MVY

846 Posts

Posted - 2002-09-06 : 14:21:13
1) Set up a linked server for ADSI (does LDAP too)

sp_addlinkedserver 'ADSI','Active Directory Services 2.5',
'ADSDSOObject','adsdatasource'
go

2) Query an LDAP server - I'm not sure what the organisation bit is but if you get the adsPath it should be in there, then you can narrow the query down a bit. A word of warning ADSI is dog slow !
Replace EXSERVER with the name of your LDAP server. The best source of docs seems to be MSDN and the Exchange Server docs - it all seems overly complicated syntax-wise though.

--Heres a query to get Full Name and Email for all
--users with surname of smith
--We've only got 8 Smith's (including me ) and it still takes 18 seconds

select givenname +' '+ sn as 'Full Name', mail as 'Email',adsPath
from openquery(ADSI, 'select adsPath,givenname,sn,mail from
''LDAP://EXSERVER'' WHERE sn=''Smith''')



HTH
Jasper Smith
Go to Top of Page

SamC
White Water Yakist

3467 Posts

Posted - 2002-09-06 : 15:17:13
Jasper,

Thanks for the direction.

I'll be able to try this over the weekend and will post results then..

SamC

Go to Top of Page
   

- Advertisement -