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

Retrieve UnicodeString from AD

Status
Not open for further replies.

tEkHEd

IS-IT--Management
Jan 29, 2003
261
GB
Hi there...

I am querying a multi-valued UnicodeString in AD and only appear to be able to retrieve the first entry...

Can anyone spot why?

Code:
    Public Function ListMultiValues(ByVal RootOU, ByVal Filter, ByVal AttributesToLoad)
        'This function will query for the value/s contained within the attribute of the
        'parsed DistinguishedName and return the values as a collection of items.
        Dim dEntry As New DirectoryEntry
        Dim dSearch As New DirectorySearcher
        Dim cEntries As SearchResultCollection
        Dim oValue As SearchResult
        Dim aAttributes() As String
        Dim i As Integer

        Try 'to connect to the parsed DN or throw an error
            If Not dEntry.Exists(RootOU) Then Throw (New Exception(RootOU & DOES_NOT_EXIST))
        Catch ex As Exception
            'Return CType(ex.Message, SearchResultCollection)
            Exit Function
        End Try


        dEntry.Path = RootOU
        dSearch.SearchRoot = dEntry
        'apply the filter if one is provided
        If Not Filter Is Nothing Then
            dSearch.Filter = "(&(objectclass=" & Filter & "))"
        End If

        dSearch.SearchScope = SearchScope.Subtree
        dSearch.PropertiesToLoad.Add(AttributesToLoad)
        cEntries = dSearch.FindAll 
        Return cEntries
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top