There is one way to open all tree nodes programmatically.
For example (NAV 2015) in Page 634 you need make this changes:
1. Add global dot net variables (Must be RunOnClient=Yes)
CurrForm System.Windows.Forms.Form.'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
ContextMenuStrip System.Windows.Forms.ContextMenuStrip.'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
BusinessGrid Microsoft.Dynamics.Framework.UI.WinForms.Controls.BusinessGrid.'Microsoft.Dynamics.Framework.UI.WinForms.Controls, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
ArrayControls System.Array.'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
(to add BusinessGrid copy Microsoft.Dynamics.Framework.UI.WinForms.Controls.dll to addins path, it is need only to add variable to page)
2. Add control (i name it PageReady) addin Microsoft.Dynamics.Nav.Client.PageReady;PublicKeyToken=31bf3856ad364e35 to page. It is need to get event when window form genereted.
3. In PageReady::AddInReady() write code like this
//Local Variables
FormID Code 40
RepeaterID Code 40
String DotNet System.String.'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
Application DotNet System.Windows.Forms.Application.'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
FormCollection DotNet System.Windows.Forms.FormCollection.'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
//Code
FormID := String.Format('{0:X8}',634); //634 is Page ID
RepeaterID := String.Format('{0:X4}',1); //1 is Repeater control ID
FormCollection := Application.OpenForms;
CurrForm := FormCollection.Item(FormCollection.Count-1);
RepeaterID := COPYSTR(CurrForm.Name,1,15) + RepeaterID + '-0008-' + COPYSTR(CurrForm.Name,26);
ArrayControls := CurrForm.Controls.Find(RepeaterID, TRUE);
IF ArrayControls.Length = 0 THEN EXIT;
BusinessGrid := ArrayControls.GetValue(0);
ContextMenuStrip := BusinessGrid.DataGrid.Columns.Item(0).HeaderCell.ContextMenuStrip;
ContextMenuStrip.Items.Item(ContextMenuStrip.Items.IndexOfKey('{8173ED7E-096D-486f-AF68-873E8DE41170}')).PerformClick ;
Here is objects with some control feature :)
/cfs-file/__key/communityserver-discussions-components-files/34/P634_2D00_NAV2017.txt