Get Information like real username from AD

V

VK

Hello,

I am trying to get the real name of the user from the Active directory via
LDAP. However it always returns me the userid, which he uses to login.
Furthermore, I would also like to retrieve additional information - i.e what
role the user has + phonenr, email etc... Here is the code I used:

Dim entry As DirectoryEntry = New DirectoryEntry("LDAP://...",
"domain\user", "userpw")
Dim mySearcher As System.DirectoryServices.DirectorySearcher = New
System.DirectoryServices.DirectorySearcher(entry)
mySearcher.Filter = ("(sAMAccountName=user)")

Response.Write("===========================================<br>")
For Each resEnt As System.DirectoryServices.SearchResult In
mySearcher.FindAll
Response.Write(resEnt.GetDirectoryEntry.Name.ToString & "<br>")
Response.Write("===========================================" & "<br>")
Next
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top