R
RSH
I am using System.DirectoryServices to query our AD in order to get
information about users.
I am having problems understanding how to get at the Username and the Email
address (to begin with)
The code below returns all of the keys (I assume) but I can't figure out how
to extract the values associated with them:
Here is the code I'm using:
Public Sub GetUserProps(SearchChars as string)
Dim sPath As String
Dim fullname As String
Dim objDirEnt As New DirectoryServices.DirectoryEntry("LDAP://server.com",
"user", "pass")
Dim objSearcher As New System.DirectoryServices.DirectorySearcher(objDirEnt)
Dim objSearchRes As System.DirectoryServices.SearchResult
Dim objProps As DictionaryEntry
Dim objvals As String
objSearcher.Filter = ("(anr=" & SearchChars & ")")
For Each objSearchRes In objSearcher.FindAll
For Each objProps In objSearchRes.Properties
Response.Write(objProps.Key & "<br>")
Next
Next
objDirEnt.Close()
End Sub
How do I get at the values for each of the keys?
Thanks you!
Ron
information about users.
I am having problems understanding how to get at the Username and the Email
address (to begin with)
The code below returns all of the keys (I assume) but I can't figure out how
to extract the values associated with them:
Here is the code I'm using:
Public Sub GetUserProps(SearchChars as string)
Dim sPath As String
Dim fullname As String
Dim objDirEnt As New DirectoryServices.DirectoryEntry("LDAP://server.com",
"user", "pass")
Dim objSearcher As New System.DirectoryServices.DirectorySearcher(objDirEnt)
Dim objSearchRes As System.DirectoryServices.SearchResult
Dim objProps As DictionaryEntry
Dim objvals As String
objSearcher.Filter = ("(anr=" & SearchChars & ")")
For Each objSearchRes In objSearcher.FindAll
For Each objProps In objSearchRes.Properties
Response.Write(objProps.Key & "<br>")
Next
Next
objDirEnt.Close()
End Sub
How do I get at the values for each of the keys?
Thanks you!
Ron