ArcGIS Pro 3.6 API Reference Guide
ArcGIS.Desktop.Catalog Namespace / ServerConnectionManager Class / CreateAGSServerConnectionFile Method
The AGS Server connection file to be created
The server connection url
An optional user name
An optional password
An optional parameter indicating whether to save connection credentials to the Windows Credential Manager (more secure)
An optional parameter indicating whether to persist the connection credentials in the .ags connection file (less secure)
An optional parameter indicating the connection type

In This Topic
    CreateAGSServerConnectionFile Method
    In This Topic
    Creates a new ArcGIS Server connection file. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    Public Shared Function CreateAGSServerConnectionFile( _
       ByVal agsFilePath As String, _
       ByVal serverUrl As String, _
       Optional ByVal userName As String, _
       Optional ByVal password As String, _
       Optional ByVal saveToWCM As Boolean, _
       Optional ByVal saveToFile As Boolean, _
       Optional ByVal connMode As ConnectionMode _
    ) As Item

    Parameters

    agsFilePath
    The AGS Server connection file to be created
    serverUrl
    The server connection url
    userName
    An optional user name
    password
    An optional password
    saveToWCM
    An optional parameter indicating whether to save connection credentials to the Windows Credential Manager (more secure)
    saveToFile
    An optional parameter indicating whether to persist the connection credentials in the .ags connection file (less secure)
    connMode
    An optional parameter indicating the connection type

    Return Value

    An Item representing the AGS server connection file which has been added to the project
    Remarks
    Cast the returned item to ServerConnectionProjectItem to access the underlying server connection via ServerConnectionProjectItem.ServerConnection
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.6 or higher.
    See Also