ArcGIS Pro 3.6 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / CatalogLayer Class / GetCatalogDataset Method
Example

In This Topic
    GetCatalogDataset Method
    In This Topic
    Returns the underlying CatalogDataset that the catalog layer is pointing to. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public CatalogDataset GetCatalogDataset()
    Public Function GetCatalogDataset() As CatalogDataset

    Return Value

    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Remarks
    A CatalogDataset is a collection of catalog dataset items, modeled as objects with a polygon representing the item footprint. Each footprint feature's attributes are properties specific to the purpose, scope, and validation status of each dataset item
    Example
    Create Catalog Layer using CatalogDataset
    //Note: Call within QueuedTask.Run()
    //Get the CatalogDataset of another Catalog layer
    var existingCatalogLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<CatalogLayer>().FirstOrDefault();
    if (existingCatalogLayer != null)
    {
      var catalogDataset = existingCatalogLayer.GetCatalogDataset();
      //Configure the settings for a new Catalog layer using the CatalogDataset of an existing layer
      var catalogLyrParams = new CatalogLayerCreationParams(catalogDataset);
      catalogLyrParams.Name = "NewCatalogLayerFromAnotherCatalogLayer";
      catalogLyrParams.DefinitionQuery = new DefinitionQuery("Query1", "cd_itemname = 'Asia'");
      LayerFactory.Instance.CreateLayer<CatalogLayer>(catalogLyrParams, MapView.Active.Map);
    }
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.1 or higher.
    See Also