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

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

问题描述

Google云端硬盘有一个很酷的功能:可以从Shared With Me中添加一个文件或文件夹到我的云端硬盘。

.stack.imgur.com / sdc1p.jpgalt =然后我可以用同样的方式从我的云端硬盘中删除这个文件(注意如果我删除网络版中的共享文件,它不会去垃圾箱)




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

解决方案

添加到我的云端硬盘会更改相关项目的父项集合。要改变这种情况,您需要将项目放弃而不是删除。



使用about.get调用来检索我的驱动器ID,然后从列表中删除该ID的父母在文件/文件夹的文件资源中。用新的父母名单更新文件。


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)

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.

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