ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Core.Data.UtilityNetwork Namespace / Subnetwork Class / Export Method
The path of a JSON file where the information about a subnetwork will be exported.
The options describing how a subnetwork will be exported.
Example

In This Topic
    Export Method (Subnetwork)
    In This Topic
    Exports information about a subnetwork into a JSON file. This also deletes rows in the Subnetworks table that are marked as deleted.
    Syntax

    Parameters

    outputJsonPath
    The path of a JSON file where the information about a subnetwork will be exported.
    subnetworkExportOptions
    The options describing how a subnetwork will be exported.
    Exceptions
    ExceptionDescription
    outputJsonPath must have the .json extension.
    outputJsonPath or subnetworkExportOptions is null.
    Export cannot be performed in an active edit session.
    A geodatabase-related exception has occurred.
    Example
    Export Subnetwork
    public void ExportSubnetwork(UtilityNetwork utilityNetwork, string subnetworkName, Uri exportResultJsonPath)
    {
      using (UtilityNetworkDefinition utilityNetworkDefinition = utilityNetwork.GetDefinition())
      using (SubnetworkManager subnetworkManager = utilityNetwork.GetSubnetworkManager())
      {
        Subnetwork subnetwork = subnetworkManager.GetSubnetwork(subnetworkName);
    
        IReadOnlyList<NetworkAttribute> networkAttributes = utilityNetworkDefinition.GetNetworkAttributes();
        IReadOnlyList<NetworkSource> networkSources = utilityNetworkDefinition.GetNetworkSources();
    
        NetworkSource electricDevice = networkSources.First(f => f.Name.Contains("ElectricDevice"));
    
        // Export options
        SubnetworkExportOptions subnetworkExportOptions = new SubnetworkExportOptions()
        {
          SetAcknowledged = false,
          IncludeDomainDescriptions = true,
          IncludeGeometry = true,
          ServiceSynchronizationType = ServiceSynchronizationType.Asynchronous,
    
          SubnetworkExportResultTypes = new List<SubnetworkExportResultType>()
          {
            SubnetworkExportResultType.Connectivity,
            SubnetworkExportResultType.Features
          },
    
          ResultNetworkAttributes = new List<NetworkAttribute>(networkAttributes),
    
          ResultFieldsByNetworkSourceID = new Dictionary<int, List<string>>()
            { { electricDevice.ID, new List<string>() { "AssetID" } } }
        };
    
    
        subnetwork.Export(exportResultJsonPath, subnetworkExportOptions);
      }
    }
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.2 or higher.
    See Also