ArcGIS Pro 3.6 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / ILayerFactory Interface / CreateLayers Method / CreateLayers(BulkLayerCreationParams,ILayerContainerEdit) Method
A BulkLayerCreationParams object.
A map or group layer where the Layers will be added.

In This Topic
    CreateLayers(BulkLayerCreationParams,ILayerContainerEdit) Method
    In This Topic
    Creates a readonly list of new Layer instances using the specified BulkLayerCreationParams and adds it to a container such as a map. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax

    Parameters

    layerParams
    A BulkLayerCreationParams object.
    container
    A map or group layer where the Layers will be added.

    Return Value

    A Readonly list of Layer.
    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    layerParams or container is null.
    An elevation surface layer cannot be used as a container for bulk layer creation.
    Unable to bulk create layers with a combination of standard and custom items.
    Unable to bulk create layers with data supplied as a mixture of Uris, Items and data connections.
    Unable to bulk create layers with the supplied child LayerCreationParams.
    Remarks
    The bulk layer creation process creates the layers it is able to per the data supplied. If invalid Uris, data connections or Items exist amongst valid data, there will be a mismatch in the number of layers created compared to the number of data items supplied. For example, 5 Uris are supplied, but only 4 layers are created because one of the Uris points to a dataset that does not exist. LayerFactory.CreateLayers will return the layers created, but no information regarding the invalid dataset. The only exception to this is if all datasets are invalid (and no layers are created); in this scenario an System.ArgumentException will be thrown.

    See the BulkLayerCreationParams.RollbackBehavior for information about rollback options with bulk layer creation when the BulkLayerCreationParams object is created with a set of LayerCreationParams objects.

    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.4 or higher.
    See Also