G
Guest
Hallo!
I'm filling my treenode tv with AD-infos with the following code:
____________________________________________________________________
private enum AdImages
{
AdRoot,
Ou,
Container,
OpenContainer,
Computer,
User,
Group,
Unknown,
Unavailable
}
private DirectoryEntry _AdRootDSE = null;
private DirectoryEntry _AdRoot = null;
try
{
this._AdRootDSE = new DirectoryEntry(@"LDAP://rootDSE");
this._AdRoot = new DirectoryEntry("LDAP://" + (string)
this._AdRootDSE.Properties["defaultNamingContext"].Value);
TreeNode root = new TreeNode((string)this._AdRootDSE.Properties
["defaultNamingContext"].Value,
(int)AdImages.AdRoot,
(int)AdImages.AdRoot);
root.Tag = this._AdRoot;
this.tV.Nodes.Clear();
this.tV.Nodes.Add(root);
this.tV.ExpandAll();
}
catch
{
throw new Exception("Error connecting to AD");
}
____________________________________________________________________
Now I would like to select a single node in the treeview. I've got the info
which one stored in a string like this: "OU=Testunit,DC=Domain,DC=local".
How can I select this one? I've tried a lot of things but nothing works. Can
anyone help me please?
Thanks in advance!!!
I'm filling my treenode tv with AD-infos with the following code:
____________________________________________________________________
private enum AdImages
{
AdRoot,
Ou,
Container,
OpenContainer,
Computer,
User,
Group,
Unknown,
Unavailable
}
private DirectoryEntry _AdRootDSE = null;
private DirectoryEntry _AdRoot = null;
try
{
this._AdRootDSE = new DirectoryEntry(@"LDAP://rootDSE");
this._AdRoot = new DirectoryEntry("LDAP://" + (string)
this._AdRootDSE.Properties["defaultNamingContext"].Value);
TreeNode root = new TreeNode((string)this._AdRootDSE.Properties
["defaultNamingContext"].Value,
(int)AdImages.AdRoot,
(int)AdImages.AdRoot);
root.Tag = this._AdRoot;
this.tV.Nodes.Clear();
this.tV.Nodes.Add(root);
this.tV.ExpandAll();
}
catch
{
throw new Exception("Error connecting to AD");
}
____________________________________________________________________
Now I would like to select a single node in the treeview. I've got the info
which one stored in a string like this: "OU=Testunit,DC=Domain,DC=local".
How can I select this one? I've tried a lot of things but nothing works. Can
anyone help me please?
Thanks in advance!!!