Unable to retrieve list on Recycle Bin through Sharepoint API

godzillaKP 66 Reputation points
2022-12-14T11:57:30.883+00:00

Hello everyone,

I've two sharepoint accounts, and on their files, I am only able to list the Recycle Bin (first stage) in one of these, and I really don't know why.

This is the url that I am using (foo_bar_domain_com is an example of an account like foo.bar@keyman .com):

https://space-my.sharepoint.com/personal/foo_bar_domain_com/_api/web/recycleBin

In the account that I am unable to retrieve the list, I got only this:

<?xml version="1.0" encoding="utf-8"?><feed xml:base="https://space-my.sharepoint.com/personal/foo_bar_domain_com/_api/" xmlns="http://www.w3.org/2005/Atom" 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" xmlns:gml="http://www.opengis.net/gml"><id>6a2b6-cd6b-429-a86-6fbfde6f</id><title /><updated>2022-12-14T11:21:09Z</updated><author><name /></author></feed>

On the other account, I got the list of files and folders right after the updated part.

Note that through web page (not API) I am able to list both lists without problem.

Anyone knows why in one I can list deleted items and in other don't, and how can I solve this?

Thank you

Microsoft 365 and Office | SharePoint | Development
Microsoft 365 and Office | SharePoint | For business | Windows
0 comments No comments
{count} votes

Accepted answer
  1. RaytheonXie_MSFT 40,476 Reputation points Microsoft External Staff
    2022-12-16T06:54:19.57+00:00

    Hi @godzillaKP
    I'm glad to hear you solve the problem ,if you have any issue about SharePoint, you are welcome to raise a ticket in this forum.

    By the way, since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others." and according to the scenario introduced here: Answering your own questions on Microsoft Q&A, I would make a brief summary of this thread:

    [Unable to retrieve list on Recycle Bin through Sharepoint API]

    Issue Symptom:
    There are two account, and only able to list the Recycle Bin (first stage) in one of account by using following api

    https://space-my.sharepoint.com/personal/foo_bar_domain_com/_api/web/recycleBin  
    

    Current status:
    Fixed by the site level api.

    https://space-my.sharepoint.com/personal/foo_bar_domain_com/_api/site/recycleBin  
    

    The similar issue for reference
    https://stackoverflow.com/questions/43884609/not-getting-site-recycle-bin-content-using-sharepoint-rest-api

    You could click the "Accept Answer" button for this summary to close this thread, and this can make it easier for other community member's to see the useful information when reading this thread. Thanks for your understanding!

    0 comments No comments

3 additional answers

Sort by: Most helpful
  1. RaytheonXie_MSFT 40,476 Reputation points Microsoft External Staff
    2022-12-15T02:36:00.587+00:00

    Hi @godzillaKP
    Per my test, I found when the result is not a error. If you don'e have any item in the recycle bin, the rest api will return the result like this
    270773-image.png

    Please check if there is some items in the site and you will need SharePoint site collection administrator permission to view the items in recycl bin
    Here is the document for details
    https://support.microsoft.com/en-us/office/restore-deleted-items-from-the-site-collection-recycle-bin-5fa924ee-16d7-487b-9a0a-021b9062d14b


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


    1 person found this answer helpful.
    0 comments No comments

  2. godzillaKP 66 Reputation points
    2022-12-15T10:44:09.13+00:00

    There are two API calls, one for site level and another for site collection level (the one that I was using till now).

    For site level, I should have use:

    https://space-my.sharepoint.com/personal/foo_bar_domain_com/_api/site/recycleBin

    Now I am able to list.

    Found the solution here: https://stackoverflow.com/questions/43884609/not-getting-site-recycle-bin-content-using-sharepoint-rest-api

    Thank you for the help!

    1 person found this answer helpful.
    0 comments No comments

  3. godzillaKP 66 Reputation points
    2022-12-15T10:07:47.673+00:00

    I am using an account A, to be added on SharePoint site collection administrator, in each of these accounts (B and C) that I am trying to reach with API.

    Through account A login, I am able to reach each sharepoint data, and even recycle bin, but when I try to use the API, I am only able to get the data of one. I've even tried with other accounts, adding account A as SharePoint site collection administrator.

    After posting this thread, I noticed that the only difference between that account B, where I am able to get the list through API and the other C, is that on that account B, I've used account A to delete these files and folders, on account C, it was deleted through account C user. Made another test on another account and same result like account C user, can only get the list on recycle bin, related with the user that delete these under the same user login.

    My question now is, how can I get the full list, not based on user deleted by through API?

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.