从谷歌驱动器中永久删除文件 [英] Permanently delete file from google drive

查看:12
本文介绍了从谷歌驱动器中永久删除文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

How permanently delete file on google drive using google script I find only method setTrashed. It moved file into Trash, but how remove file permanently

解决方案

Apps Script has the ability to access Google API's, but you need to explicitly enable them before they can be used.

The Drive API, can be used to delete a file.

Drive API - Delete

The Drive API method is Remove method instead of Delete.

To enable the Drive API, open the Resources menu, then choose the Advanced Google Services, and a menu will pop up. You need to click the Drive API service. Make sure that the green "ON" text is showing.

Once you've done that, you can use the auto-complete in the code editor to see what is available for methods. When you type the word "Drive" in the code editor, then enter a period, a context menu will appear. Then you can choose Files, etc.

Drive.Files.remove(fileId);

NOTE:

Take note of the link: Google Developers Console

You must visit your Console, and enable the services there also. And it looks like the only way you can get to your Apps Script Project in the Console is through the link in that Advanced Google Services pop up window. Going to the Google console without the correct project number in the URL fails to show your Apps Script project.

You can get to the console with:

Google Console

But that is a dead end because it doesn't show the Apps Script projects that you own.

这篇关于从谷歌驱动器中永久删除文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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