ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Mapping.Offline Namespace / GenerateOfflineMap Class / GetCanGenerateReplicas Method
The map to check for sync-enabled content. Connected version must be default.
Example

In This Topic
    GetCanGenerateReplicas Method
    In This Topic
    Gets whether the map contains sync-enabled content. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    Public Function GetCanGenerateReplicas( _
       ByVal map As Map _
    ) As Boolean
    public bool GetCanGenerateReplicas( 
       Map map
    )

    Parameters

    map
    The map to check for sync-enabled content. Connected version must be default.

    Return Value

    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Map cannot be null
    Remarks
    Sync-enabled content refers to content in the map being sourced from sync-enabled feature services. Note: if the sync-enabled content is from a branch versioned feature service then the branch version must be the default version.
    Example
    Check Map Has Sync-Enabled Content
    {
        var hasSyncEnabledContent = GenerateOfflineMap.Instance.GetCanGenerateReplicas(map);
        if (hasSyncEnabledContent)
        {
            //TODO - use status...
        }
    }
    Generate Replicas for Sync-Enabled Content
    {
        //namespace ArcGIS.Desktop.Mapping.Offline
        var extent = MapView.Active.Extent;
        //Check map has sync-enabled content that can be taken offline
        //Note: Run within QueuedTask
        var hasSyncEnabledContent = GenerateOfflineMap.Instance.GetCanGenerateReplicas(map);
        if (hasSyncEnabledContent)
        {
            //Generate Replicas and take the content offline
            //sync-enabled content gets copied local into a SQLite DB
            var gen_params = new GenerateReplicaParams()
            {
                Extent = extent, //SR of extent must match map SR
    
                //DestinationFolder can be left blank, if specified,
                //it must exist. Defaults to project offline maps location
                DestinationFolder = @"C:\Data\Offline"
            };
            //Sync-enabled layer content will be resourced to point to the
            //local replica content.
            GenerateOfflineMap.Instance.GenerateReplicas(map, gen_params);
        }
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also