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

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

DispatcherQueue null when trying to update Ui property in ViewModel(尝试更新ViewModel中的Ui属性时DispatcherQueue为空)
Drawing over all windows on multiple monitors(在多个监视器上绘制所有窗口)
Programmatically show the desktop(以编程方式显示桌面)
c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
LINQ many-to-many relationship, how to write a correct WHERE clause?(LINQ多对多关系,如何写一个正确的WHERE子句?)