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.
I create a Geodatabase using DatabaseConnectionProperties and specify a version name in the connection properties. I tried different version name formats such as:
But when I do that, the constructor throws:
The version definitely exists (it’s created in Pro before I run the test).
If I create the Geodatabase without specifying a version and then call:
…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:
Since branch versions are tied to services, I tried using a service geodatabase approach, but in my console project Visual Studio shows:
So I can’t even instantiate/use ServiceGeodatabase from my code.
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!"); }