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?
TIA
DougP
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