Skip to content

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.

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”.

ParameterTypeDefaultDescription
liststring—Display name or ID of the list.
itemIdstring—List item ID.
ParameterTypeDefaultDescription
sessionZoanMicrosoftFilesSession—Connect session. Inherited inside Connect’s body.

This activity does not return a value.

MessageCause 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.

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"]