 |
|
 |
First, thanks for the control, it is gerat!
But has a little bug...
The "Root" node's child items has doubled their child items.
Because in the ADPicker_Load theres a line: treeView1.Nodes[0].Expand(); ,and after that theres a foreach(...), that is populating the child items with their child items (so we can expand them).
BUT the treeView1.Nodes[0].Expand(); triggers the treeView1_AfterExpand function, and that has a foreach() that can populate the list... so the foreach is unnecessary here.
The solution: Just delete (or comment out) this two lines from ADPicker_Load(...) function:
foreach (TreeNode childNode in parentNode.Nodes)
AddTreeNodes(childNode);
ps.: Sorry for my bad English
|
|
|
|
 |
|
 |
Sorry but if there are more than two sub OU's then it will not show unless the two lines are in the code.
Here it is with the code (AD directory)
Root
- ParentOU-ColaCompany
-- ChildOU-SaleForce
--- ChildOU-Drives
-- ChildOU-SaleForce
--- ChildOU-Drives
It's doubled
Here it is with out the code (AD directory)
Root
- ParenOU-ColaCompany
-- ChildOU-SaleForce
Missing ChildOU-Drives
|
|
|
|
 |
|
 |
Here is a fix for this double items. Insert this to AfterExpand
if (e.Node.Text != "") // We know that the root tag is blank, if it is not blank then expand and get child nodes.
{
foreach (TreeNode childNode in e.Node.Nodes)
{
AddTreeNodes(childNode);
}
}
|
|
|
|
 |
|
 |
Sorry missing fix for child nodes
if (e.Node.Text != "") // We know that the root tag is blank, if it is not blank then expand and get child nodes.
{
foreach (TreeNode childNode in e.Node.Nodes)
{
if (childNode.Nodes.Count < 1) //We know that if there is somthing in the child notes then it will do nothing else it will try to search.
{
childNode.ImageIndex = 2;
AddTreeNodes(childNode);
}
}
}
|
|
|
|
 |
|
 |
Just wanted to take the time to thank you as this control makes my life so much easier.
I recently added this control to one of my project and was wondering if there is an easy way to reset the control. For example, a Reset button on my form would restore Adpicker back its original state: Nothing selected, ADsPath set to "". Any suggestion welcome.
Thanks again.
Lucas
|
|
|
|
 |
|
 |
Thanks for the feedback - glad you found it useful. You can probably just call CollapseAll() on the TreeView control, then manually set ADsPath to String.Empty. Also, set SelectedNode=null. Let me know if that does what you were hoping for.
|
|
|
|
 |
|
 |
Thank you very much for your reply. I must be missing something here because once I add the ADPicker control to my vb.net project, I only have access to the read-only ADsPath property. Is there a way for me to access the underlying Treeview control? I think I would have to modify your code to somehow expose a method that would do what you are suggesting. Let me know if I am way off.
|
|
|
|
 |
|
 |
Just wanted to say Thank you, I've been looking for something like this for a couple of weeks. Awesome Control.
|
|
|
|
 |
|
 |
My pleasure. Glad you found it useful.
-M
|
|
|
|
 |
|
 |
I get all user defined OUs doubled in the tree view
|
|
|
|
 |
|
 |
Because is added event treeView1_AfterExpand who added again OU to tree.
Best Regards,
Sebastian.
|
|
|
|
 |
|
 |
Hi I want to know if somebody implemets the order of the users, before the tree load(ADPicker_Load)
Thaks!
|
|
|
|
 |
|
 |
You should be able to just set Sorted=true for node(s) you want sorted.
|
|
|
|
 |
|
 |
Hi,
How can i get the selected object?
Example, i selected an ou=Users, how can i get this?
I need this selection to become avaliable to create users in a certain OU.
Is this possible with your control or i can change the source to be possible?
thanks in advance,
Ricardo
Ricardo
|
|
|
|
 |
|
 |
The ADsPath property is changed each time you select a node. This gives you the fully-qualified path to the object.
|
|
|
|
 |
|
 |
I like to know how I can use it in my program !?!
how I can give it the domain and the admin username and password
and get the selected OU so I can create users in?
I'm new to this and I like to learn it
Thank
|
|
|
|
 |
|
 |
Marc, thanks for sharing. Works beautifully. Is there any way to sort the directory listing? I have a pretty large domain with approximately 40,000 users and computer scattered accross 165 OUs. As you can imagine, browsing can be quite a challenge.
-Ian
'If we don't do our best to fix a problem, we may as well take blame for it, even if it is not or own.'
|
|
|
|
 |
|
|
 |
|
 |
I am trying to use this tool in Visual Studio 2005, and am having some problems. I have just started developing and need some assistance with the procedure for downloading this tool and adding it to one of my projects. Also, what type of licensing issues exist if I reuse this tool? Thanks in advance for help.
|
|
|
|
 |
|
 |
I haven't used it with Visual Studio 2005, but I assume it will work the same way as in VS 2003.
In design mode, right-click on the Toolbox menu and select Add/Remove Items. In the .NET Framework Components tab, click Browse and locate the ADPicker.dll assembly. Click OK and the ADPicker will be added to the list of available Toolbox items. Now, drag the ADPicker control onto your Windows form.
Did that help you?
-- modified at 9:43 Thursday 20th October, 2005
Regarding your licensing issues question: This is a code-sharing site and my code should be considered open source, otherwise known as free for private and commercial consumption.
|
|
|
|
 |
|
 |
I receive an error message when I drag the tool onto the form:
Failed to create component 'ADPicker'. The error message follows:
'System.Runtime.InteropServices.COMExtension (0x80070548): The specified domain either does not exist or could not be contacted.
at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
at System.DirectoryServices.DirectoryEntry.Bind()
at System.DirectoryServices.DirectoryEntry.get_AdsObject()
at System.DirectoryServices.PropertyValueCollection.PopulateList()
........
Any ideas?
|
|
|
|
 |
|
 |
That's the standard error when your machine isn't connected to an Active Directory.
|
|
|
|
 |
|
 |
Thanks very much for taking the time....this was the error. I know this is a common question, but you could offer any insight into why you choose to write in C# over VB? I'm just learning VB so I'm still fascinated with the argument of C# vs VB. Thanks very much for your time.
|
|
|
|
 |
|
 |
:(All i keep getting is the message, the specified domain does not exist?
|
|
|
|
 |
|
 |
Are you quite certain that your PC is a member of the Active Directory you are trying to browse?
|
|
|
|
 |