Is there a way to get the meta for a deleted item (file / folder) for Office365 OneDrive via REST API?

I'm looking for a way to get the meta for a deleted item (file / folder). I can get change logs indicating that a certain action was taken on an item, and I was also able to get the item itself if it wasn't deleted.

The problem arises when this item is removed. In this case, I only know the id of the element, and when I query the element itself, I get a 404 (the talking object has been deleted).

I recently read the following posts

It says that the deleted item is sent to the user's trash, where it can be restored or deleted permanently. If it is removed from the Recycle Bin, it will go to the Recycle Bin of Sites where the administrator can restore or delete it permanently. So now I'm looking for a way to access the Recycle Bin for the user as well as the Recycle Bin for a site collection via the REST API.

Although I know the endpoints of the recycle bin mentioned here , they don't work for me as I keep getting an empty array even though I have a couple of files / folders present in the recycle bin (users' recycle bin ). Perhaps I am missing the settings / settings?

I have 2 goals;

  • Find the file (one deleted) in the user's recycle bin. (/ Perosonal / abc_tenant_onmicrosoft_com)
  • If it is not, look for the file in the recycle bin of the sites recycle bin.

Both of them are via REST APIs.

Many thanks!

+3


source to share


2 answers


Cart resource endpoint URI:

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

      

How to distinguish cart items

The shopping cart resource exposes the SP.RecycleBinItem.itemType property , which returns the type of the cart item .

Examples of

The following query demonstrates how to return File

items:



http://<onedrive for business url>/_api/web/RecycleBin?$filter=(ItemType eq 1)

      

and the following is how to return Folder

items:

http://<onedrive for business url>/_api/web/RecycleBin?$filter=(ItemType eq 5)

      

where the token <onedrive for business url>

for the OneDrive For Business site has the following format:

https://tenant-my.sharepoint.com/personal/username_tenant_onmicrosoft_com

      

+3


source


Whether there is a

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

      



work? I grabbed the structure from: SP.RecycleBinItem.restore Method (sp.js) .

+1


source







All Articles