Results 1 to 30 of 30

Thread: Trying to understand accessing AD through VB.NET...

Threaded View

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Mar 2004
    Location
    Orlando, FL
    Posts
    1,618

    Trying to understand accessing AD through VB.NET...

    ...and failing miserably...

    I am trying to get to data in a group called _All Employees that is under Users, and I have no idea how to do it. I can see Users, but I don't understand how I drill down to the next level.

    Code:
    deDirectoryEntry = New DirectoryEntry
    deDirectoryEntry.Path = "LDAP://ADServer/CN=Users;DC=MyDomain,DC=com"
    deDirectoryEntry.Username = "MyDomain\ReadOnlyUser"
    deDirectoryEntry.Password = "password"
    
    Dim oSearcher As New DirectorySearcher
    Dim srcResults As SearchResultCollection
    
    oSearcher.SearchRoot = deDirectoryEntry
    oSearcher.Filter = "(&(objectClass=user) (cn=" & strUserName & "))"
    
    srcResults = oSearcher.FindAll()
    
    For Each result As SearchResult In srcResults
    ...

    And so on. I don't really understand the navigation here. How do I get down to the _All Employees group beneath this which has the user info I need. Any help would be appreciated. This stuff confuses the hell out of me.
    Last edited by SeanGrebey; Aug 14th, 2008 at 12:43 PM.
    Sean

    Some days when I think about the next 30 years or so of my life I am going to spend writing code, I happily contemplate stepping off a curb in front of a fast moving bus.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width