ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Core.Data.NetworkDiagrams Namespace / DiagramManager Class / GetDiagramTemplates Method
Example

In This Topic
    GetDiagramTemplates Method
    In This Topic
    Gets the full list of available DiagramTemplates. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public IReadOnlyList<DiagramTemplate> GetDiagramTemplates()
    Public Function GetDiagramTemplates() As IReadOnlyList(Of DiagramTemplate)

    Return Value

    A list of DiagramTemplates.
    Exceptions
    ExceptionDescription
    A geodatabase-related exception has occurred. For example, the diagram manager is invalid.
    This method or property must be called within the lambda passed to QueuedTask.Run
    Example
    Get Diagram Templates
    public void RetrieveDiagramTemplates(UtilityNetwork utilityNetwork)
    {
      using (DiagramManager diagramManager = utilityNetwork.GetDiagramManager())
      {
        // get all templates
        IReadOnlyList<DiagramTemplate> templates = diagramManager.GetDiagramTemplates();
    
        // get a template by name
        DiagramTemplate template = diagramManager.GetDiagramTemplate(templateName);
      }
    }
    Get Network Diagrams from a Diagram Template
    public void GetNetworkDiagramFromDiagramTemplates(UtilityNetwork utilityNetwork)
    {
      using (DiagramManager diagramManager = utilityNetwork.GetDiagramManager())
      {
        // get the first templates
        DiagramTemplate template = diagramManager.GetDiagramTemplates().FirstOrDefault();
    
        // get the network diagrams fromt he template
        IEnumerable<NetworkDiagram> diagrams = template.GetNetworkDiagrams();
    
        // or get a network diagram by name
        NetworkDiagram diagram = template.GetNetworkDiagram(diagrameName);
      }
    }
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also