Google Drive - 如何从代码中清空垃圾(以编程方式)?

Google Drive - How to empty trash from code (programmatically)?(Google Drive - 如何从代码中清空垃圾(以编程方式)?)
本文介绍了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 - 如何从代码中清空垃圾(以编程方式)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

Custom Error Queue Name when using EasyNetQ for RabbitMQ?(使用 EasyNetQ for RabbitMQ 时自定义错误队列名称?)
How to generate password_hash for RabbitMQ Management HTTP API(如何为 RabbitMQ 管理 HTTP API 生成密码哈希)
Rabbitmq Ack or Nack, leaving messages on the queue(Rabbitmq Ack 或 Nack,将消息留在队列中)
Setup RabbitMQ consumer in ASP.NET Core application(在 ASP.NET Core 应用程序中设置 RabbitMQ 消费者)
Specify Publish timeouts in mass transit(指定公共交通中的发布超时)
RabbitMQ asynchronous support(RabbitMQ 异步支持)