Aina Dev
Aina Dev

Reputation: 3

Can't Retrieve Deleted Items by Other Users from SharePoint Recycle Bin via REST API, but Can See Them on Website

I have a Site Collection Administrator account on a SharePoint (On-Prem SharePoint Server Subscription Edition) site, and I need to programmatically retrieve deleted items from the Recycle Bin using the SharePoint REST API.

When I use the following API call, I can only retrieve the items I deleted:

GET https://{site_url}/_api/web/RecycleBin

However, when I view the Recycle Bin through the SharePoint website, I can see items deleted by other users, as well restore them.

What I have tried:

What I am trying to achieve: I need to retrieve all deleted items (including those deleted by other users) via the SharePoint REST API, similar to what I can see on the website.

My questions:

  1. Is there a specific permission or setting required to access deleted items by other users through the REST API?
  2. Is there an alternative method (perhaps through Microsoft Graph API or some other approach) to retrieve these items?

Any help or guidance on this issue would be appreciated!

Upvotes: 0

Views: 127

Answers (1)

Daniel Owen
Daniel Owen

Reputation: 1

I was having the same issue and was really confused as the user can see the files in the web interface just not in the;

_api/web/recycleBin

The key here is to this instead; (swap "web" with "site")

_api/site/recycleBin

I am still testing but this seems to completely fix the issue

Upvotes: 0

Related Questions