ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / GroupLayer Class / RemoveStandaloneTables Method
The StandaloneTables to remove
Example Version

RemoveStandaloneTables Method (GroupLayer)
Removes the specified StandaloneTables from the container. This method must be called on the MCT. Use QueuedTask.Run.
Syntax
public void RemoveStandaloneTables( 
   IEnumerable<StandaloneTable> tables
)

Parameters

tables
The StandaloneTables to remove
Exceptions
ExceptionDescription
Invalid container. The StandaloneTables are not part of this container or one of it's descendants.
This method or property must be called within the lambda passed to QueuedTask.Run.
Remarks
The tables must all belong to the same container or a container that is a child of the parent.
Example
Remove a Standalone table
//get the first group layer that has at least one table
var grp_layer = MapView.Active.Map.GetLayersAsFlattenedList()
  .OfType<GroupLayer>().First(g => g.StandaloneTables.Count > 0);
var map = MapView.Active.Map;//assumes non-null

QueuedTask.Run(() =>
{
  //get the tables from the map container
  var tables = map.GetStandaloneTablesAsFlattenedList();
  //delete the first...
  if (tables.Count() > 0)
  {
    map.RemoveStandaloneTable(tables.First());
    //or delete all of them
    map.RemoveStandaloneTables(tables);
  }

  //delete a table from a group layer
  //assumes it has at least one table...
  grp_layer.RemoveStandaloneTable(grp_layer.StandaloneTables.First());
});
Requirements

Target Platforms: Windows 11, Windows 10

ArcGIS Pro version: 3 or higher.
See Also