ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Desktop.Mapping.Offline Namespace / GenerateOfflineMap Class / RemoveReplicas Method
The map whose replicas will be removed.
Example

In This Topic
    RemoveReplicas Method
    In This Topic
    Removes all replicas from the map content. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public void RemoveReplicas( 
       Map map
    )
    Public Sub RemoveReplicas( _
       ByVal map As Map _
    ) 

    Parameters

    map
    The map whose replicas will be removed.
    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Map cannot be null
    Map has no syncable content
    Remarks
    RemoveReplicas unregisters the corresponding replicas on the feature service. At the conclusion of RemoveReplicas, the local syncable layers are re-sourced to point back to their original feature service (and not the local content). Any un-sync'd edits present in the local content are lost. Call SynchronizeReplicasfirst to sync any unsync'd edits before calling RemoveReplicas.
    If a map contains a local replica that was previously unregistered then attempting to unregister it again is treated as a no-op.
    Call GetCanRemoveReplicas to determine if the map has local syncable content. Calling RemoveReplicas on a map with no syncable content will throw a System.InvalidOperationException. The local SQLite geodatabase containing the replicas unregistered on the service is not deleted.
    Example
    Remove Replicas for Syncable Content
    //namespace ArcGIS.Desktop.Mapping.Offline
    var extent = MapView.Active.Extent;
    var map = MapView.Active.Map;
    
    //await if needed...
    QueuedTask.Run(() =>
    {
      //Check map has local syncable content
      //Either..
      //var canSyncContent = GenerateOfflineMap.Instance.GetCanSynchronizeReplicas(map);
      //Or...both accomplish the same thing...
      var canRemove = GenerateOfflineMap.Instance.GetCanRemoveReplicas(map);
      if (canRemove)
      {
        //Remove Replicas - any unsync'd changes are lost
        //Call sync _first_ to push any outstanding changes if
        //needed. Local syncable content is re-sourced
        //to point to the service
        GenerateOfflineMap.Instance.RemoveReplicas(map);
      }
    });
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also