I am able to connect and get the CN values but I am not able to ge the uid values
any suggestions
Brought to you By Nedaineum
The Portal to Geek-tum
Code:
Public Function GetAllUsers(ByVal ldapServerName As String) As Hashtable
'To retrieve list of all LDAP users
'This function returns HashTable
Dim sServerName As String = "mail"
Dim oRoot As DirectoryEntry = New DirectoryEntry("LDAP://" & ldapServerName & _
"/OU=Benefits,OU=Regina Users,ou=Managed Objects,dc=saho1,dc=hin,dc=sk,dc=ca")
Dim oSearcher As DirectorySearcher = New DirectorySearcher(oRoot)
Dim oResults As SearchResultCollection
Dim oResult As SearchResult
Dim RetArray As New Hashtable
Try
oSearcher.PropertiesToLoad.Add("uid")
oSearcher.PropertiesToLoad.Add("cn")
oSearcher.PropertiesToLoad.Add("ou")
oResults = oSearcher.FindAll
For Each oResult In oResults
If Not oResult.GetDirectoryEntry().Properties("cn").Value = "" Then
'RetArray.Add(oResult.GetDirectoryEntry().Properties("uid").Value, _
' oResult.GetDirectoryEntry().Properties("cn").Value)
End If
Next
Catch e As Exception
MsgBox("Error is " & e.Message)
Return RetArray
End Try
Return RetArray
End Function
any suggestions
Brought to you By Nedaineum
The Portal to Geek-tum