ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / KnowledgeGraphMappingExtensions Class / GetRootNodes Method
Example

In This Topic
    GetRootNodes Method
    In This Topic
    Gets the set of root nodes as a MapMemberIDSet. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public static MapMemberIDSet GetRootNodes( 
       MapView mapView
    )
    Public Shared Function GetRootNodes( _
       ByVal mapView As MapView _
    ) As MapMemberIDSet

    Parameters

    mapView
    Exceptions
    ExceptionDescription
    Map cannot be null.
    Map is not a link chart.
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Example
    Get records that are set as Root Nodes
    await QueuedTask.Run(() =>
    {
      MapMemberIDSet rootNodes = MapView.Active.GetRootNodes();
      var rootNodeDict = rootNodes.ToDictionary();
    
      // rootNodeDict is a Dictionary<MapMember, List<long>>
    
      // access a particular mapMember in the Dictionary
      if (rootNodeDict.ContainsKey(mapMember))
      {
        var oids = rootNodeDict[mapMember];
      }
    
      // OR iterate through the dictionary
      foreach (var (mm, oids) in rootNodeDict)
      {
        // do something
      }
    });
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.4 or higher.
    See Also