Use DeleteMultiple (preview)

[This topic is pre-release documentation and is subject to change.]

Important

This is a preview feature.

Preview features aren’t meant for production use and may have restricted functionality. These features are available before an official release so that customers can get early access and provide feedback.

DeleteMultiple

Delete multiple rows of data in elastic tables with a single request.

You must use the OrganizationRequest class because the SDK for .NET doesn't have a DeleteMultipleRequest class. Learn how to use messages with the SDK for .NET.

The following DeleteMultipleExample static method uses the DeleteMultiple message with the OrganizationRequest class to delete multiple rows from the contoso_SensorData elastic table using the alternate key to include the partitionid to uniquely identify the rows.

public static void DeleteMultipleExample(IOrganizationService service)
{
    string tableLogicalName = "contoso_sensordata";

    List<EntityReference> entityReferences = new() {
        {
            new EntityReference(logicalName: tableLogicalName,
               keyAttributeCollection: new KeyAttributeCollection
               {
                  { "contoso_sensordataid", "3f56361a-b210-4a74-8708-3c664038fa41" },
                  { "partitionid", "deviceid-001" }
               })
        },
        { new EntityReference(logicalName: tableLogicalName,
               keyAttributeCollection: new KeyAttributeCollection
               {
                  { "contoso_sensordataid", "e682715b-1bba-415e-b2bc-de9327308423" },
                  { "partitionid", "deviceid-002" }
               })
        }
    };

    OrganizationRequest request = new(requestName:"DeleteMultiple")
    {
        Parameters = {
            {"Targets", new EntityReferenceCollection(entityReferences)}
        }
    };

    service.Execute(request);
}

Availability

DeleteMultiple is supported only for elastic tables. Elastic tables don't support table relationship cascading behavior, which can result in unpredictable execution times for delete operations. If you use DeleteMultiple on a standard table, you get the error: DeleteMultiple has not yet been implemented.

Examples

You can find sample code on GitHub in github.com/microsoft/PowerApps-Samples:

See also

Use bulk operation messages
Elastic tables
Elastic table sample code
Sample: SDK for .NET Use bulk operations
Sample: Web API Use bulk operations