Say you have a list in SharePoint with some data that you need to have deleted.

The standard Flow action “Delete item” or “Delete file”, will actually delete the item, but only to the recycle bin. You need to use the Rest API to permanently delete the items

If you have a lot of items, that regularly needs to be deleted, you would want to permanently delete those items, so you don’t have to empty the recycle bin every now and then.

Flow action Details
Get items Comment: Get all the items you want to have deleted. This can be all items or a filtered list of items.
Site Address: Address of your site
List name: The name of your list
Get items Comment: Apply to each means go through all the values from the “Get items” action. Use the output value from the “Get items” action.
Output value: outputs(‘Get_items’)?[‘body/value’]
Get items Comment: This action deletes the item permanently.
Site Address: Address of your site
Method: DELETE
Uri: _api/web/lists/GetByTitle(‘Temp list’)/items(@{items(‘Apply_to_each’)?[‘ID’]})
Headers:
TIP: click on the “Switch headers to text mode”
and copy the JSON below to quickly get all the headers in your task.
`{
“Accept”: “application/json;odata=verbose”,
“Content-Type”: “application/json;odata=verbose”,
“X-RequestDigest”: “$(“#__REQUESTDIGEST”).val()”,
“IF-MATCH”: “*”
}

Complete flow looks like this:


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.