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

查看:43
本文介绍了有没有办法通过 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.

当该项目被删除时出现问题.在那种情况下,我只知道 Item 的 ID,当我查询 Item 本身时,我得到 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

它表示已删除的项目会进入用户的回收站,在那里可以永久恢复或删除.如果从回收站中删除,它会转到网站集回收站,管理员可以在其中恢复或永久删除它.因此,我现在正在寻找一种方法来访问用户的回收站以及通过 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?

我有两个目标;

  • 在用户的回收站中找到一个文件(删除的那个).(/personal/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 属性,返回 回收站项目的类型.

示例

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

The following query demonstrates how return File items:

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

以及以下如何返回Folder项:

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

,其中 OneDrive For Business 站点的令牌 具有以下格式:

,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天全站免登陆