REST API Recycle Bin DeleteAll Issues

  • 23 August 2019
  • 3 replies
  • 55 views

Badge +2

Not sure is anyone can help me, but litle confused as why this does not work as documented by Microsoft.  

 

Microsoft API

https://docs.microsoft.com/en-us/previous-versions/office/sharepoint-visio/jj246426(v=office.15)

 

According to the documented API, to remove all items in the recycl bin you could call the following: 

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

 

I started with a small proof of concept.  You need to get the X-RequestDigest First, which I did in the following web request:

 

4071i7FAB128684C84471.png

In the next step I extracted the X-RequestDigest through the Query XML control.

4072iEE0E499E105FF36D.png

Then I made the call to the API via the Web Request Control.

4073i6EBF4088951CDC27.png

Thast all it took to set it up, but I was surprised that it did not work even though it reported a success.

The logs came back with a 200 success, but when i looked at the recycle bin nothing was deleted.  Has anyone got this to work, or am I missing something?

 

Log Content:

Getting Content Info:<?xml version="1.0" encoding="utf-8"?><d:GetContextWebInformation xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss

 

Extracted: 0x000922E7F139F87D82D00BDF0BCD00F3B00000D7D0AC29C02A000C097G20F876E340G37DB01100024D3DFEEC00D80AA569400000F000BBCCE15G70D0F0G007,22 Aug 2019 22:17:30 -0000

 

Error Flag:False - Error

 

HTTP Result: 200 - <?xml version="1.0" encoding="utf-8"?><d:DeleteAll xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmln

 


3 replies

Badge +17

@iceman while the workflow is completing the call successfully, I am not sure you can make that call as you are attempting. I could be wrong, but would suggest using postman to test that call out first. If that works, then look at the authentication to see what may be going wrong when running it via the workflow. You may need it to run with elevated permissions. 

Badge

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

Change "web" to "site" in the url:

POST http://<sitecollection>/<site>/_api/site/RecycleBin/deleteAll()

The deletion will work, the reason being the Recyclebin is actually at site level, not web level.

 

 

Badge +12

@spuser1234 , @iceman ....Sorry for side track but I really need help with this and trying to find who can help me....below are my 2 posts which I had posted a while back and still trying to get help with configuration....

 

Post 1: Get Item level Permissions in Nintex Workflow

 

Post 2: Copy Item Permission When Creating Item in Another List

 

Thanks in advance.

Reply