MS SharePoint – Lists – Delete List
MS SharePoint – Lists – Delete List
Requests deletion of the selected list and returns an operation result. This is a list-level operation, not deletion of one record. It exposes no restore or If-Match input. Permission metadata for this operation is unverified.
Action details
| Property | Value |
|---|---|
| Action label | MS SharePoint – Lists – Delete List |
| Category | CloudTools |
| Apex class and method | DeleteSharePointList.deleteList |
| Input type | DeleteSharePointList.DeleteSharePointListInput |
| Output type | List<DeleteSharePointListOutput> |
| Authorization | Operation-specific requirements must be verified. |
| Microsoft Graph request | DELETE /v1.0/sites/{siteId}/lists/{listId} |
Prerequisites and permissions
Configure a CloudTools Connector with Connector Type set to Microsoft 365. Complete user sign-in for delegated access. For supported application access, grant application permissions and administrator consent. The calling identity must have access to the relevant site, list, library, or item; tenant policy and resource configuration still apply.
Unverified permission metadata: The permission provider returns no permission sets and explicitly states that this operation’s requirements have not been verified. This does not mean that no permissions are required. Verify API support, authorization type, and required consent in your tenant before planning an automation; do not infer them from another list operation.
See the Microsoft list resource reference.
Inputs
Supply one non-null request with nonblank required identifiers. IDs must belong to the indicated site, list, or drive; do not substitute Salesforce IDs or browser URLs.
| Input | Apex field | Type | Required | Description |
|---|---|---|---|---|
| Site Id | siteId | String | Yes | SharePoint site identifier. |
| List Id | listId | String | Yes | SharePoint list identifier. |
The global invocable input does not expose connectorId. Direct subscriber Apex and Flow calls use CloudTools connector selection. Resolve dynamic values before invocation; this action does not resolve replacement tokens.
Outputs
Returns one operation result with success and message. It does not return a Microsoft resource. Handle callout exceptions in the caller.
| Output | Apex field | Type | Description |
|---|---|---|---|
| Success | success | Boolean | Whether the delete succeeded. |
| Message | message | String | Result message. |
Use in Flow
Add MS SharePoint – Lists – Delete List in Flow Builder. Verify Microsoft API support and application permission requirements before using this action in Flow; its permission metadata is incomplete. This implementation processes only the first input request and is not a bulk operation.
Use in custom Apex
This subscriber-org example uses the Apptigent namespace. Replace the identifiers, configure the connector, and run in a context that permits callouts. Arrange authorization before calling and handle exceptions in the caller.
Apptigent.DeleteSharePointList.DeleteSharePointListInput request =
new Apptigent.DeleteSharePointList.DeleteSharePointListInput();
request.siteId = 'REPLACE_WITH_SITE_ID';
request.listId = 'REPLACE_WITH_LIST_ID';
List<Apptigent.DeleteSharePointList.DeleteSharePointListOutput> results =
Apptigent.DeleteSharePointList.deleteList(
new List<Apptigent.DeleteSharePointList.DeleteSharePointListInput>{ request }
);
Boolean succeeded = !results.isEmpty() && results[0].success;
System.debug(succeeded);
Use in a Lightning Web Component
Use deleteSharePointList from msSharePointConnectorLib, through MSSharePointConnectorController. These c/ imports apply to an LWC in the same namespace. The function accepts one request object, including connectorId when applicable.
Set request.connectorId to select a configured Connector record. The controller passes this request selection through SharePointAction. The field belongs to the controller request, not the global invocable input type.
sharePointActionExample.js
import { LightningElement } from 'lwc';
import { deleteSharePointList, MSSharePointObjects } from 'c/msSharePointConnectorLib';
export default class SharePointActionExample extends LightningElement {
connectorId = 'REPLACE_WITH_CONNECTOR_RECORD_ID';
result = null;
errorMessage = '';
isRunning = false;
completed = false;
async handleRun() {
if (this.isRunning || this.completed) {
return;
}
this.isRunning = true;
this.errorMessage = '';
try {
const request = MSSharePointObjects.inputs.list();
request.connectorId = this.connectorId;
request.siteId = 'REPLACE_WITH_SITE_ID';
request.listId = 'REPLACE_WITH_LIST_ID';
const result = await deleteSharePointList(request);
if (!result?.success) {
throw new Error('The action did not return a usable result.');
}
this.result = result;
this.completed = true;
} catch (error) {
this.errorMessage = error.requiresInteractiveAuthorization
? 'Sign in to Microsoft for the connector, then try again.'
: error.message || 'The SharePoint action failed.';
} finally {
this.isRunning = false;
}
}
}
sharePointActionExample.html
<template>
<lightning-button label="Run action" onclick={handleRun}
disabled={isRunning}></lightning-button>
<p role="alert">{errorMessage}</p>
</template>
The library resolves to one operation object with success and message.
LWC rawJson serializes the mapped Apex object; it is not the untouched Microsoft response or an additional global invocable output. Use getMSSharePointAuthorizationState, beginMSSharePointAuthorization, and createMSSharePointOAuthMessageHandler to arrange delegated sign-in. The library normalizes controller errors, including requiresInteractiveAuthorization when available; it does not automatically sign in or retry.
The example prevents repeating a completed operation. Reset completed only for a new deliberate operation. If a failure leaves the outcome uncertain, inspect the resource before retrying. For Copy, completed means the request returned, not that the background copy finished.
Error handling and troubleshooting
| Symptom | What to check |
|---|---|
| Required fields error | Supply a nonempty request list, a non-null first request, and the required identifiers or body values. |
| Authorization or access denied | Check connector selection, sign-in, application versus delegated permissions, administrator consent, and resource access. |
| Resource not found | Verify the parent site, list, and drive IDs. Distinguish list item IDs from drive item IDs and retain permission or version IDs with their resource. |
| Missing fields or items | Check query inputs, first-page behavior, supported expansions, item type, and mapped output limitations. |
| Unexpected connector | Review the connector selection behavior described above and the Microsoft 365 default connector. |
| Operation rejected | Inspect the Microsoft error, JSON field values, library or page state, supported API capabilities, and tenant policies. |