public CIMProjectServerConnection ServerConnection {get; set;}
Public Property ServerConnection As CIMProjectServerConnection
public CIMProjectServerConnection ServerConnection {get; set;}
Public Property ServerConnection As CIMProjectServerConnection
//This workflow would work for var agsFilePath = @"C:\Data\ServerConnectionFiles\AcmeSampleService.ags"; //ServerConnectionProjectItem supports .ags, .wms, .wmts, .wfs, and .wcs files var server_conn_item = ItemFactory.Instance.Create(agsFilePath) as ArcGIS.Desktop.Catalog.ServerConnectionProjectItem; //Get the server connection - passwords are never returned var serverConnection = server_conn_item.ServerConnection as CIMProjectServerConnection; //Add to an AGS service connection var service_connection = new CIMAGSServiceConnection() { URL = "URL to the AGS _service_ on the AGS _server_", ServerConnection = serverConnection }; // Add a new layer to the map var layerParams = new LayerCreationParams(service_connection); layerParams.MapMemberPosition = MapMemberPosition.AddToBottom; var map = MapView.Active.Map; await QueuedTask.Run(() => { var layer = LayerFactory.Instance.CreateLayer<FeatureLayer>(layerParams, map); });
Target Platforms: Windows 11, Windows 10