Is there a way to retrieve the meta for a deleted

2020-03-26 03:55发布

I'm looking for a way to retrieve the meta for a deleted item(file/folder). I'm able to get change logs indicating that a certain action has been performed on an Item, and I've been able to retrieve the Item itself as well if it hasn't been deleted.

The problem arises when this item gets deleted. In that case, I only know the ID of the Item and when I query the Item itself, I get a 404 (saying object has been deleted).

Recently, I read the following posts

It says a deleted item goes to user's recycle bin where it can be restored or deleted permanently. If deleted from recycle bin it goes to Site Collection Recycle Bin, where an Admin can restore or delete it permanently. So, I'm now looking for a way to access the Recycle Bin for a user and also the Site collection's recycle bin through the REST API.

Though I'm aware of the Recycle Bin endpoints mentioned here but they don't work for me as I keep getting an empty array even though I have a couple files/folders present in the recycle bin(user's recycle bin). I might be missing some configuration/setting?

I have 2 goals;

  • Find a file(the one deleted) in user's recycle bin. (/perosonal/abc_tenant_onmicrosoft_com)
  • If it isn't there, then look for the file in Site Collection's recycle bin.

Both of these through the REST API.

Much appreciated!

2条回答
戒情不戒烟
2楼-- · 2020-03-26 04:16

Does

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

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

查看更多
我想做一个坏孩纸
3楼-- · 2020-03-26 04:26

Recycle Bin resource endpoint URI:

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

How to distinguish Recycle Bin items

Recycle Bin resource exposes SP.RecycleBinItem.itemType property that returns the type of the Recycle Bin item.

Examples

The following query demonstrates how return File items:

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

and the the following one how to return Folder items:

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

,where token <onedrive for business url> for OneDrive For Business site has the following format:

https://tenant-my.sharepoint.com/personal/username_tenant_onmicrosoft_com
查看更多
登录 后发表回答