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

can not get UID

Status
Not open for further replies.

bitmite

Programmer
Dec 2, 2003
122
CA
I am able to connect and get the CN values but I am not able to ge the uid values

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
 
I'm not sure there is a "uid" value... there are "guid" and "sid".

The guid is a 128 bit binary number that uniquely identifies (across the entire domain and all OU's) an object such as a computer or person.

If that is what you are looking for, you will have to change that number from a binary to a hex. I do not know how to do it, but I'm sure someone does.

Jon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top