1

I want to delete files in Sharepoint 2016 from its recycle bin. I am able to delete files from my folder using requests.delete. However, not able to do the same from recycle bin.

Can we achieve that?

3 Answers3

1

Try this endpoint:

POST http://<sitecollection>/<site>/_api/web/RecycleBin(recyclebinitemid)/deleteObject()

reference: https://learn.microsoft.com/en-us/previous-versions/office/sharepoint-visio/jj246911(v=office.15)

Amos
  • 2,030
  • 1
  • 5
  • 9
1

Interestingly, I have been able to achieve this via shareplum.

cred = HttpNtlmAuth(username,password)
site = Site("sharepointsiteurl",version=Version.v365,auth=cred)
folder = site.Folder('Shared Documents/My Folder')
folder.delete_file('MyFile.csv')

This deletion is apparently deleting file completely. Neither there on Recycle bin nor on Second stage recycle bin.

1

Did you try Powershell script? There is a Sharepoint function for that

  • 1
    Yes, I came across that. However, I wanted to only achieve this via python in unix as my connecting python script is also on unix server. – Problem_Solver23 Aug 10 '20 at 10:42