-
Jan 13th, 2014, 04:13 AM
#121
New Member
Re: Populate TreeView with Active Directory objects
Originally Posted by chris128
Active Directory TreeView / Select AD Container Dialog
(I have a WPF version as well, if anyone wants that just let me know)
Hi,
i'm interessted in the wpf version. Where can i get it?
Greetings
Max
-
Jan 28th, 2014, 03:54 PM
#122
New Member
Re: Populate TreeView with Active Directory objects
I just downloaded the AD Tree View control from this thread (Thread 38 has it attached), but it's version 1.3. Where can I find the latest version (1.5 or newer)?
Thanks, Krissy
-
May 25th, 2015, 01:06 PM
#123
New Member
Re: Populate TreeView with Active Directory objects
Hi
I would be in trestles in the wpf version as well. Would you be able to send me the source files or code if possible?
Many thanks
Jamie
-
Nov 27th, 2017, 11:30 AM
#124
Lively Member
Re: Populate TreeView with Active Directory objects
Amended version of original project with ability to show groups as well as containers/OUs - which is something I needed for my project
As per example form checkboxes to set Boolean of true or false for ShowGroups and ShowOUs properties
Defaults to false for ShowGroups and true for ShowOUs
Code amended to also show correct icon for groups as well
Changed from .NET 3.5 to .NET 4.5
Hopefully may be of use to someone....
SelectAdContainerDialog_revised.zip
Last edited by wingers; Apr 16th, 2021 at 04:09 AM.
-
Oct 3rd, 2021, 09:09 AM
#125
New Member
Re: Populate TreeView with Active Directory objects
I know this is an old post but this library code still works great. I've added a few things after changing the target framework to 4.72 to speed up the load time (since I was only interested with targeting organizationalunit and container objects):
In the AdTreeViewForm.vb file change the "LoadAdNodes" sub to this (or you could just add the entries I have highlighted to your sub):
Code:
Private Sub LoadAdNodes(ByVal RootNodeObject As Object)
Dim RootNode As AdTreeNode = DirectCast(RootNodeObject, AdTreeNode)
Dim Children As New List(Of AdTreeNode)
Try
Using RootDirectoryEntry As New DirectoryEntry("LDAP://" & _DomainController & ":389/" & RootNode.DistinguishedName)
RootDirectoryEntry.AuthenticationType = AuthenticationTypes.Secure
If Not String.IsNullOrEmpty(_Username) Then
RootDirectoryEntry.Username = _Username
RootDirectoryEntry.Password = _Password
End If
RootDirectoryEntry.Children.SchemaFilter.Add("organizationalUnit")
RootDirectoryEntry.Children.SchemaFilter.Add("container")
For Each ChildObject As DirectoryEntry In RootDirectoryEntry.Children
ChildObject.Children.SchemaFilter.Add("organizationalUnit")
ChildObject.Children.SchemaFilter.Add("container")
Try
Dim ChildObjectType As String = ChildObject.SchemaClassName
If ChildObjectType = "organizationalUnit" OrElse ChildObjectType = "container" Then
Dim ChildNode As New AdTreeNode
ChildNode.DisplayName = CStr(ChildObject.Properties("name").Value)
If ChildObjectType = "organizationalUnit" Then
ChildNode.Type = AdTreeNode.AdObjectType.OU
ElseIf ChildObjectType = "container" Then
ChildNode.Type = AdTreeNode.AdObjectType.Container
Else
ChildNode.Type = AdTreeNode.AdObjectType.Unknown
End If
ChildNode.DistinguishedName = CStr(ChildObject.Properties("distinguishedName").Value).Replace("/", "\/")
For Each ChildChildObject As DirectoryEntry In ChildObject.Children
ChildChildObject.Children.SchemaFilter.Add("organizationalUnit")
ChildChildObject.Children.SchemaFilter.Add("container")
Try
If ChildChildObject.SchemaClassName = "organizationalUnit" OrElse ChildChildObject.SchemaClassName = "container" Then
ChildNode.Nodes.Add(New AdTreeNode With {.DisplayName = "Loading..."})
Exit For
End If
Finally
ChildChildObject.Dispose()
End Try
Next
Children.Add(ChildNode)
End If
Finally
ChildObject.Dispose()
End Try
Next
End Using
Children.Sort()
LoadFinished(True, Nothing, DirectCast(RootNodeObject, AdTreeNode), Children)
Catch ex As Exception
LoadFinished(False, "The following error was encountered whilst trying to load the domain objects: " & ex.Message, Nothing, Nothing)
End Try
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|