问题类似于这篇文章( Documents deleted using Google Docs API still visible in Google Drive 不能真正让它与建议的解决方案一起工作。当我们使用 delete() 函数删除文件时,文件是否被删除不是这里的问题,问题是该文件将始终在网络浏览器中可见,甚至无法手动删除。我想知道是否有一种方法可以删除该文件并使其在网络用户界面中消失?
非常感谢。
最佳答案
在 v3 API 中,您应该能够使用其 ID 删除文件。不要忘记对 service.files().delete() 返回的 Delete 对象调用 execute()。
import com.google.api.services.drive.model.*;
import com.google.api.services.drive.Drive;
Drive service = ...;
com.google.api.services.drive.model.File file = ...;
service.files().delete(file.getId()).execute();
关于google-drive-api - 使用 Google Drive API 删除文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15118145/