Select to view content in your preferred language

Pro SDK (.NET) console app + Utility Network: can’t see/edit branch versions (only DEFAULT returned)

322
1
03-11-2026 08:22 PM
OscarYam
Occasional Contributor

Hi all,

I’ve been asked to build a .NET console application using the ArcGIS Pro SDK to edit features in a Utility Network. Since UN uses branch versioning, I shouldn’t edit DEFAULT directly—I need to connect to and edit a named branch version.

Environment

  • ArcGIS Pro: 3.1.4
  • .NET: 6.0
  • Database: SQL Server
  • Connection: Enterprise Geodatabase direct connect

What I tried (Enterprise Geodatabase connection)

I create a Geodatabase using DatabaseConnectionProperties and specify a version name in the connection properties. I tried different version name formats such as:

  • versionName
  • user@domain.versionName (and similar fully-qualified formats)

But when I do that, the constructor throws:

  • Exception: “The specified version does not exist.”

The version definitely exists (it’s created in Pro before I run the test).

What I observed

If I create the Geodatabase without specifying a version and then call:

  • Geodatabase.GetVersions()

…it returns only one version: DEFAULT. No child versions show up under DEFAULT either.

I also checked whether the geodatabase supports versioning and what versioning type it is. It reports:

  • Supports versioning: Yes
  • Versioning type: Traditional

Attempted alternative (service-based)

Since branch versions are tied to services, I tried using a service geodatabase approach, but in my console project Visual Studio shows:

  • Compile error: ‘ServiceGeodatabase’ is inaccessible due to its protection level

So I can’t even instantiate/use ServiceGeodatabase from my code.

0 Kudos
1 Reply
Aashis
by Esri Contributor
Esri Contributor

Hi @OscarYam ,

The UN requires a branch versioning-enabled feature service to work with a utility network in the EGDB environment. Looks like you haven't published your UN dataset. Refer to https://pro.arcgis.com/en/pro-app/latest/help/data/utility-network/publishing-and-consuming-services... on how to prepare and publish a UN dataset. 

Once your dataset is published, you should use ServiceConnectionProperties to access your dataset as follows. 

string url = "https://myserver.esri.com/server/rest/services/UN/FeatureServer";
string utilityNetworkName = "L12MyUnNetwork_Utility_Network";

ServiceConnectionProperties serviceProperties = new ServiceConnectionProperties(new Uri(url));

using (Geodatabase geodatabase = new Geodatabase(serviceProperties))
using (UtilityNetwork utilityNetwork = geodatabase.OpenDataset<UtilityNetwork>(utilityNetworkName))
using (UtilityNetworkDefinition utilityNetworkDefinition = utilityNetwork.GetDefinition())
{
  // work with a utility network 
}

Also, for the CoreHost applications, you may need to use ArcGISSignOn.Instance.SignInWithCredentials to authenticate with your portal before using ServiceConnectionProperties, depending on your service configuration

      bool isSignInWithCredentials = ArcGISSignOn.Instance.SignInWithCredentials(new Uri("https://myserver.esri.com/portal"),"user","pass", out _ ,out _);
      if (!isSignInWithCredentials)
      {
        Console.WriteLine("Cannot sign-in to the portal!");
      }

  

0 Kudos