从谷歌驱动器永久删除文件 [英] Permanently delete file from google drive
问题描述
如何使用谷歌脚本永久删除谷歌驱动器上的文件我发现只有方法 setTrashed.它将文件移入垃圾箱,但如何永久删除文件
Apps Script 具有访问 Google API 的能力,但您需要在使用前明确启用它们.
Drive API,可用于删除文件.
但这是一个死胡同,因为它没有显示您拥有的 Apps 脚本项目.
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.
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:
But that is a dead end because it doesn't show the Apps Script projects that you own.
这篇关于从谷歌驱动器永久删除文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!