删除之前从与我共享到我的云端硬盘中添加的文件 [英] Remove a file that was previously added from Shared With Me to My Drive

查看:17
本文介绍了删除之前从与我共享到我的云端硬盘中添加的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Google 云端硬盘有一项很酷的功能:可以将与我共享的文件或文件夹添加到我的云端硬盘.

Google Drive has a cool feature: one can add a file or folder from Shared With Me to My Drive.

然后我可以以同样的方式从我的云端硬盘"中删除此文件(请注意,如果我在网页版中删除共享文件,它不会进入废纸篓)

Then I can delete this file from My Drive in the same manner (note that if I delete shared file in web version it won't go to Trash)

但是,我在尝试使用 Google Drive API 删除此文件时收到 403 Forbidden 错误(因为我不是此文件的所有者,权限不足).因此,可以看出,这不是一个简单的删除请求.如何实现此功能?

However, I am getting 403 Forbidden error while trying to delete this file using Google Drive API (because of insufficient permissions due to that I am not owner of this file). So, as one can see, this is not a simple Delete request. How can I implement this functionality?

推荐答案

添加到我的云端硬盘会更改相关项目的父集合.要更改这一点,您需要取消父项而不是删除.

Add to My Drive changes the parents collection for the item in question. To change this, you will want to unparent the item rather than delete.

使用 about.get 调用检索我的云端硬盘 ID,然后从文件/文件夹的文件资源中的父级列表中删除该 ID.使用新的父母列表更新文件.

Use the about.get call to retrieve the My Drive ID, then remove that ID from the list of parents in the file resource for the file/folder. Update the file with the new list of parents.

这篇关于删除之前从与我共享到我的云端硬盘中添加的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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