Google Drive - 如何从代码中清空垃圾(以编程方式)? [英] Google Drive - How to empty trash from code (programmatically)?

查看:47
本文介绍了Google Drive - 如何从代码中清空垃圾(以编程方式)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮助我将一个项目与 Google Drive 集成.问题是 Google Drive 的垃圾文件夹永远不会清空,因此最终由于空间不足,Google Drive 与桌面的同步停止工作.

Please help me to integrate a project with Google Drive. The problem is that Google Drive trash folder is never emptied, so eventually Google Drive synchronization with desktop stops working due to the lack of space.

我需要将垃圾箱配置为不保留已删除的文件(首选选项),或者以编程方式从 C# 代码(不太首选)或其他编程语言(最后的选项)中清空它.

I need either to configure the trash to not keep deleted files (preferred option) or empty it programatically from C# code (less preferred), or other programing language (last resort option) .

如何从代码或脚本或其他内容中清空 Google 云端硬盘回收站?

How do I empty Google Drive trash from code or script or whatever?

推荐答案

Google Drive API 没有公开清空垃圾箱的方法,但它有一个 delete 方法来永久删除文件,无需将它们送入垃圾箱:

The Google Drive API doesn't expose a method to empty the trash but it has a delete method to delete files permanently, without sending them into the trash:

https://developers.google.com/drive/v2/reference/文件/删除

您还可以通过检查 文件资源,然后对它们调用delete.

You can also retrieve files from trash by checking the trashed label of the Files resource and then call delete on them.

这篇关于Google Drive - 如何从代码中清空垃圾(以编程方式)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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