SharePoint — Delete list item
SharePoint — Delete list item
Section titled “SharePoint — Delete list item”Type: msfiles-delete-list-item · Package: OneDrive / SharePoint v1.0.5
Deletes an item from a SharePoint list. The item goes to the site’s recycle bin, from where it can be restored during the organization’s retention period.
How it works
Section titled “How it works”It works on the session created with OneDrive/SharePoint — Connect. Pass it in the session parameter, or place this activity inside the body of Connect to inherit it automatically.
Once deleted, the itemId no longer works: if you retry the delete, Microsoft Graph answers itemNotFound, which you can treat as “already deleted”.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
list | string | — | Display name or ID of the list. |
itemId | string | — | List item ID. |
Optional parameters
Section titled “Optional parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
session | ZoanMicrosoftFilesSession | — | Connect session. Inherited inside Connect’s body. |
Output
Section titled “Output”This activity does not return a value.
Common errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
No OneDrive/SharePoint session available. Provide 'session' from an msfiles-connect activity, or place this activity inside the Connect activity's body so the session is inherited automatically. | The activity is outside Connect’s body and did not receive session. Place it inside the body or pass session = session. |
This activity needs a SharePoint site. Set 'siteId' in the Connect activity. | Connect was opened without siteId. |
'list' is required. / 'itemId' is required. | The parameter is empty or its expression returned null. |
itemNotFound (Microsoft Graph, 404) | The list does not exist, or there is no item with that itemId (it may have been deleted already). |
accessDenied (Microsoft Graph, 403) | The connection is missing Sites.ReadWrite.All or the account cannot delete items from the list. |
Example
Section titled “Example”Clean up closed requests:
OneDrive/SharePoint — Connect credential = credential("m365-operations") siteId = siteId └─ body: SharePoint — Get list items list = "Requests" → output: requests For each r in requests └─ If condition = r["fields"]["Status"].ToString() == "Closed" └─ then: SharePoint — Delete list item list = "Requests" itemId = r["id"]Related activities
Section titled “Related activities”- SharePoint — Get list items — locate the item to delete.
- SharePoint — Update list item — change instead of deleting.
- SharePoint — Add list item — add an item.
- All OneDrive / SharePoint activities