Home All Groups Group Topic Archive Search About

Populating ComboBox with list of OU's from AD

Author
16 Oct 2005 1:38 AM
Primera
I'm trying to populate a ComboBox on Form.load with a list of the OU's pulled
from AD.  Here is the code that does not work:

Dim rootdir As New System.DirectoryServices.DirectoryEntry
_("LDAP://dc=corp,dc=abc,dc=com")
        Dim rootsearch As New
System.DirectoryServices.DirectorySearcher(rootdir)
        Dim result As System.DirectoryServices.SearchResult
        rootsearch.SearchScope = DirectoryServices.SearchScope.Subtree
        rootsearch.Filter = ("(objectClass = organizational Unit)")
        For Each result In rootsearch.FindAll()
            ComboBox2.Items.Add(result.GetDirectoryEntry)
        Next

Any help would be greatly appreciated.....

Thanks

Author
16 Oct 2005 2:19 AM
Bob Butler
"Primera" <Prim***@discussions.microsoft.com> wrote in message
news:6FC09133-22E0-42C7-B886-0D7EB30A778F@microsoft.com
> I'm trying to populate a ComboBox on Form.load with a list of the
> OU's pulled from AD.  Here is the code that does not work:
>
> Dim rootdir As New System.DirectoryServices.DirectoryEntry


--
<response type="generic" language="VB.Net">
This newsgroup is for users of Visual Basic version 6.0
and earlier and not the misleadingly named VB.Net
or VB 200x.  Solutions, and often even the questions,
for one platform will be meaningless in the other.
When VB.Net was released Microsoft created new newsgroups
devoted to the new platform so that neither group of
developers need wade through the clutter of unrelated
topics.  Look for newsgroups with the words "dotnet" or
"vsnet" in their name.  For the msnews.microsoft.com news
server try these:

microsoft.public.dotnet.general
microsoft.public.dotnet.languages.vb

</response>