Google Drive - How to empty trash from code (programmatically)?(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/文件/删除
您还可以通过检查 trashed 标签从垃圾箱中检索文件noreferrer">文件资源,然后对它们调用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 - 如何从代码中清空垃圾(以编程方式)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Google Drive - 如何从代码中清空垃圾(以编程方式


- WebMatrix WebSecurity PasswordSalt 2022-01-01
- 输入按键事件处理程序 2022-01-01
- 带有服务/守护程序应用程序的 Microsoft Graph CSharp SDK 和 OneDrive for Business - 配额方面返回 null 2022-01-01
- 良好实践:如何重用 .csproj 和 .sln 文件来为 CI 创建 2022-01-01
- C# 中多线程网络服务器的模式 2022-01-01
- 如何用自己压缩一个 IEnumerable 2022-01-01
- MoreLinq maxBy vs LINQ max + where 2022-01-01
- C#MongoDB使用Builders查找派生对象 2022-09-04
- 在哪里可以找到使用中的C#/XML文档注释的好例子? 2022-01-01
- Web Api 中的 Swagger .netcore 3.1,使用 swagger UI 设置日期时间格式 2022-01-01