ArcGIS Pro 2.8 API Reference Guide
SetDataConnection Method

ArcGIS.Desktop.Mapping Namespace > MapMember Class : SetDataConnection Method
A CIM data connection value object.
true to make sure dataset exists and of valid data type before replacing the data source e.g. you cannot change a FeatureLayer's data source to a Raster Dataset.

-or-

false to indicate no validation required. It might not already exist. This can be useful for scenarios that require data sources to be updated ahead of the data being created. Note, in these cases, the data would appear broken in the map.
Updates a MapMember's data source. This method must be called on the MCT. Use QueuedTask.Run
Syntax
public void SetDataConnection( 
   CIMDataConnection dataConnection,
   bool validateConnection
)
Public Sub SetDataConnection( _
   ByVal dataConnection As CIMDataConnection, _
   Optional ByVal validateConnection As Boolean _
) 

Parameters

dataConnection
A CIM data connection value object.
validateConnection
true to make sure dataset exists and of valid data type before replacing the data source e.g. you cannot change a FeatureLayer's data source to a Raster Dataset.

-or-

false to indicate no validation required. It might not already exist. This can be useful for scenarios that require data sources to be updated ahead of the data being created. Note, in these cases, the data would appear broken in the map.
Exceptions
ExceptionDescription
This method or property must be called within the lambda passed to QueuedTask.Run.
Requirements

Target Platforms: Windows 10, Windows 8.1

See Also

Reference

MapMember Class
MapMember Members