I have figured out how to search for a node based on text that is input, however it appears to expand every single node even if the found node is only 1 level down. I am searching for a way that it will only expand the tree path where the node is found and nothing else.
Has anyone done this before? The searching is done top down, and there is roughly 6 levels of my tree, but if a node is found at level 2 I wish for it to only expand what is needed if that makes sense.
TreeView expand and focus on searched for node
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
-
- Posts: 11
- Last visit: Thu Apr 11, 2024 5:57 am
Re: TreeView expand and focus on searched for node
Not enough info to know what you are doing. You can search for a node by name, text or path and just set teh expanded property of that node to true and that node and all parent nodes will expand. There is no way to expand a child node and not expand the parent node which actually makes no sense.
Without more info it is unclear what you are trying to accomplish or how you are searching and expanding.
Without more info it is unclear what you are trying to accomplish or how you are searching and expanding.
-
- Posts: 11
- Last visit: Thu Apr 11, 2024 5:57 am
Re: TreeView expand and focus on searched for node
You actually answered my question with just expanding the child node I am after when searching. We're working on building out a treeview for active directory but we need to be able to search for accounts and then display where that account is within the tree, what OU's it is under etc, but without expanding every OU unrelated to the found node.jvierra wrote: ↑Tue Aug 23, 2022 12:56 pm Not enough info to know what you are doing. You can search for a node by name, text or path and just set teh expanded property of that node to true and that node and all parent nodes will expand. There is no way to expand a child node and not expand the parent node which actually makes no sense.
Without more info it is unclear what you are trying to accomplish or how you are searching and expanding.
Re: TreeView expand and focus on searched for node
Why do that. Every AD object has all of that in its name. You know that as the "DistinguishedName" and that has the whole path in the correct order. Just use that. No need to search for anything.
You can use ADSI to convert the DN or RDN to and from aDSPath strings.
https://docs.microsoft.com/en-us/window ... ap-adspath
Here is an older example that gives some of the techniques. It is simple but gives an easier approach to working with AD objects.
You can use ADSI to convert the DN or RDN to and from aDSPath strings.
https://docs.microsoft.com/en-us/window ... ap-adspath
Here is an older example that gives some of the techniques. It is simple but gives an easier approach to working with AD objects.
- Attachments
-
- Demo-ADSITreeView.psf
- (23.67 KiB) Downloaded 49 times