Forums
New posts
Search forums
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
C# Community
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
VB.NET
VB.NET General Discussion
Help with directorySearcher and Treeview
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="jagoh87, post: 75388, member: 10547"] I have the following code to list all the users in my AD tree and populate a treeview from it: [CODE]Sub FillActiveDirectoryTreeView(ByRef tvw As TreeView, ByVal TopLevelDirEntriesArray As DirectoryEntry) Dim DirEntry As DirectoryEntry Dim Nd As TreeNode For Each DirEntry In TopLevelDirEntriesArray.Children Nd = New TreeNode(DirEntry.Name.Remove(0, 3)) Nd.Tag = DirEntry tvw.Nodes.Add(Nd) FillADTreeNode(Nd) Next End Sub Sub FillADTreeNode(ByRef ADNode As TreeNode) Dim DirEntry As DirectoryEntry Dim MainEntry As DirectoryEntry = CType(ADNode.Tag, DirectoryEntry) Dim Nd As TreeNode For Each DirEntry In MainEntry.Children Nd = New TreeNode(DirEntry.Name.Remove(0, 3)) Nd.Tag = DirEntry ADNode.Nodes.Add(Nd) FillADTreeNode(Nd) Nd.Tag = Nd.Text Next End Sub[/CODE] And i have the code to list all the users samAccountNames: [CODE] Dim de As DirectoryEntry = New DirectoryEntry("LDAP://OU=xxxxxxx,DC=xxxxxxxx,DC=Com") Dim objSearcher As DirectorySearcher = New DirectorySearcher(de) objSearcher.Filter = "(objectClass=User)" Dim objresults As SearchResult For Each objresults In objSearcher.FindAll() objresults.GetDirectoryEntry().Properties("sAMAccountName").Value.ToString() Next[/CODE] What i want to do is set the samAccountName value as the tag of corrensponding user node in the treeview any help would be appreciated [/QUOTE]
Insert quotes…
Verification
Post reply
VB.NET
VB.NET General Discussion
Help with directorySearcher and Treeview
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
Accept
Learn more…
Top
Bottom