有没有一种方法可以通过REST API检索Office365 OneDrive的已删除项目(文件/文件夹)的元数据? [英] Is there a way to retrieve the meta for a deleted Item (File/Folder) for Office365 OneDrive through REST API?

查看:200
本文介绍了有没有一种方法可以通过REST API检索Office365 OneDrive的已删除项目(文件/文件夹)的元数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种检索已删除项目(文件/文件夹)的元数据的方法.我可以获取更改日志,该更改日志指示已对某个项目执行了某些操作,并且如果未删除该项目,我也可以检索该项目本身.

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.

删除该项目时出现问题.在那种情况下,我只知道商品的ID,而当我查询商品本身时,我会得到一个404(说对象已被删除).

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

  • http://office.microsoft.com/en-001/windows-sharepoint-services-help/view-restore-or-delete-items-in-the-recycle-bin-of-a-sharepoint-site-HA010021434.aspx
  • http://community.office365.com/en-us/f/154/t/240959.aspx

它表示已删除的项目进入用户的回收站,可以在那里永久恢复或删除.如果从回收站中删除,它将进入网站集回收站,管理员可以在其中永久地还原或删除它.因此,我现在正在寻找一种通过REST API访问用户的回收站以及网站集的回收站的方法.

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?

我有2个目标;

  • 在用户的回收站中查找文件(已删除的文件). (/perosonal/abc_tenant_onmicrosoft_com)
  • 如果不存在,请在网站集的回收站中查找文件.

这两个都是通过REST API实现的.

Both of these through the REST API.

非常感谢!

推荐答案

回收站资源终结点URI:

Recycle Bin resource endpoint URI:

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

如何区分回收站项目

回收站资源公开 SP.RecycleBinItem返回的.itemType属性回收站项目的类型.

How to distinguish Recycle Bin items

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

示例

以下查询演示了如何返回File项:

The following query demonstrates how return File items:

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

以及以下如何返回Folder项的方法:

and the the following one how to return Folder items:

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

,其中OneDrive for Business网站的令牌<onedrive for business url>具有以下格式:

,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

这篇关于有没有一种方法可以通过REST API检索Office365 OneDrive的已删除项目(文件/文件夹)的元数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆