ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / Map Class / ReplaceDatasource Method
A Datastore that you want to find and be replaced with the replaceDatabaseStore parameter depending on the value of the validate parameter.
A Datastore that you want to replace to.
(Optional) -true- the workspace will only be updated if the replaceDatabaseStore value is a valid workspace. If it is not valid, the workspace will not be replaced.
-false- the method will set the workspace to match the replaceDatabaseStore, regardless of a valid match. In this case, if a match does not exist, then layers and standalone tables would appear broken.
(default value = true)

In This Topic
    ReplaceDatasource Method (Map)
    In This Topic
    Performs a find and replace of workspace paths for all layers and tables in the map that share that workspace path. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    Public Sub ReplaceDatasource( _
       ByVal findDatabaseStore As Datastore, _
       ByVal replaceDatabaseStore As Datastore, _
       Optional ByVal validate As Boolean _
    ) 

    Parameters

    findDatabaseStore
    A Datastore that you want to find and be replaced with the replaceDatabaseStore parameter depending on the value of the validate parameter.
    replaceDatabaseStore
    A Datastore that you want to replace to.
    validate
    (Optional) -true- the workspace will only be updated if the replaceDatabaseStore value is a valid workspace. If it is not valid, the workspace will not be replaced.
    -false- the method will set the workspace to match the replaceDatabaseStore, regardless of a valid match. In this case, if a match does not exist, then layers and standalone tables would appear broken.
    (default value = true)
    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also