ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Desktop.Catalog Namespace / ServerConnectionProjectItem Class
Members Example Version

ServerConnectionProjectItem Class
Represents a server connection project item.
Object Model
ServerConnectionProjectItem ClassProjectItemInfo ClassCIMProjectServerConnection ClassTimeInstant Class
Syntax
public sealed class ServerConnectionProjectItem : ArcGIS.Desktop.Internal.Catalog.ProjectItemInfoCrawl, ArcGIS.Desktop.Core.IMetadata, ArcGIS.Desktop.Core.IProjectItem, ArcGIS.Desktop.Core.IProjectMultiItem, System.ComponentModel.INotifyPropertyChanged  
Remarks

A server connection project item is a connection to an ArcGIS Server site, an OGC WMS service, or an OGC WMTS service that has been added to the current project. New server connections cannot be created, but an existing .ags, .wms, or .wmts file containing connection information can be added to a project.

Example
Get ServerConnectionProjectItems
/// Get all the server connections in a project
IEnumerable<ServerConnectionProjectItem> projectServers = Project.Current.GetItems<ServerConnectionProjectItem>();
Get all "ServerConnectionProjectItems"
IEnumerable<ServerConnectionProjectItem> newServerConnections = null;
newServerConnections = project.GetItems<ServerConnectionProjectItem>();
foreach (var serverItem in newServerConnections)
{
  //Do Something with the server connection.
}
Get a specific "ServerConnectionProjectItem"
ServerConnectionProjectItem serverProjItem = Project.Current.GetItems<ServerConnectionProjectItem>().FirstOrDefault(item => item.Name.Equals("myServer"));
Inheritance Hierarchy

System.Object
   ArcGIS.Desktop.Framework.Contracts.PropertyChangedBase
      ArcGIS.Desktop.Core.Item
                  ArcGIS.Desktop.Catalog.ServerConnectionProjectItem

Requirements

Target Platforms: Windows 11, Windows 10

ArcGIS Pro version: 3 or higher.
See Also