How to Temporary delete item from SharePoint List using Graph api

Viewed 448

Below is the Graph api end point that im using to delete the sharepoint list item.It deletes item permantely. I want to Delete item from sharepoint list with graph api and it moves to recycle bin.

 Method DELETE 
 https://graph.microsoft.com/v1.0/sites/{SiteID}/Lists{ListID}/items/{itemid}

How i can delete item from sharepoint list and it movies to Recylebin and Temprory delete from sharepoint list.

2 Answers

We don't currently have support for the recycle bin using Microsoft Graph. This is on our backlog but we don't have an ETA to share unfortunately.

This doesn't seem to be documented behavior but if you delete the corresponding drive item the list item is moved to the recycle bin. Basically:

curl -H "Authorization: bearer $TOKEN" 'https://graph.microsoft.com/v1.0/sites/dec1a018-f546-4983-adba-b3d41b3bf9f2/lists/981130f9-6c38-4da6-b7af-21cf1174e57b/items/112?expand=driveItem' 
curl -H "Authorization: bearer $TOKEN" -X DELETE 'https://graph.microsoft.com/v1.0/drives/b!GKDB3kb1g0mturPUGzv58brB18eTryZPoNQ7QtBxl9T5MBGYOGymTbevIc8RdOV7/items/01C4M7MJJQI5II4WNTXVBLD4HRPGJJ2FTK'

The opposite problem (performing permanent delete of drive items) is discussed at https://github.com/microsoftgraph/microsoft-graph-docs/issues/4630.

Related