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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LDAP look up for tags available

Status
Not open for further replies.

DougP

MIS
Dec 13, 1999
5,985
US
I want to find out every dirSearcher.PropertiesToLoad.Add("xxx") you can LDAP...
I have this code which email, sir name, given name
is there a way to loop through this >>> Dim de As System.DirectoryServices.DirectoryEntry = sr.GetDirectoryEntry()
and list all of the Properties , such as manager, phone and whatever it contains?
and also print out the values?
such as
for each item in sr.GetDirectoryEntry()
debug.print Property " = " value
next
then is shows this
sn = smith
givenname = fred
mail = fredsmith@abc.com
etc for eveything in this sr.GetDirectoryEntry?

Code:
        Dim configuration As System.Configuration.Configuration = _
             System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~")
        ' Get the section.
        Dim authenticationSection As Web.Configuration.AuthenticationSection = _
            CType(configuration.GetSection( _
            "system.web/authentication"), Web.Configuration.AuthenticationSection)
        '    AuthenticationSection.Mode
        If authenticationSection.Mode = System.Web.Configuration.AuthenticationMode.Windows Then
            Dim arrUserIdentity As String() = User.Identity.Name.Split("\")
            Try
                Session("UserDomain") = arrUserIdentity(0).ToString()
                Session("UserWindowsID") = arrUserIdentity(1).ToString()
                Dim NetworkDomain As String = Session("UserDomain")
                Dim dirEntry As System.DirectoryServices.DirectoryEntry
                Dim dirSearcher As System.DirectoryServices.DirectorySearcher
                dirEntry = New System.DirectoryServices.DirectoryEntry("LDAP://" & NetworkDomain & "")
                dirSearcher = New System.DirectoryServices.DirectorySearcher(dirEntry)
                dirSearcher.Filter = "(samAccountName=" & Session("UserWindowsID") & ")"
                dirSearcher.PropertiesToLoad.Add("GivenName")
                'Users First Name 
                dirSearcher.PropertiesToLoad.Add("Mail")
                'Users e-mail address 
                dirSearcher.PropertiesToLoad.Add("sn")
                'Users last name       
....

TIA

DougP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top