ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / ILayerFactory Interface / CopyLayer Method
The layer to be copied
A layer container i.e. a map or another group layer where the layer will be copied to.
A 0-based index represents the position of the group layer within the container - 0 means it will added to the very top as the first layer in the container.

In This Topic
    CopyLayer Method (ILayerFactory)
    In This Topic
    Copy a layer. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    Function CopyLayer( _
       ByVal layer As Layer, _
       ByVal container As ILayerContainerEdit, _
       Optional ByVal index As Integer _
    ) As Layer

    Parameters

    layer
    The layer to be copied
    container
    A layer container i.e. a map or another group layer where the layer will be copied to.
    index
    A 0-based index represents the position of the group layer within the container - 0 means it will added to the very top as the first layer in the container.

    Return Value

    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    This layer does not support copying
    Container cannot be null
    Remarks
    Specify the target map or group layer to which the layer will be copied.
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also