如何使用 NodeJS 和 Google Drive API v3 将文件移至回收站。 下面几行不起作用:
await drive.files.update({ fileId, trashed: true }); // not working
await drive.files.update({ fileId }, { trashed: true }); // not working
最佳答案
我相信你的情况和目标如下。
- 您想使用带有 googleapis 和 Node.js 的 Drive API v3 将文件移动到垃圾箱。
drive
可用于使用 Drive API 的“Files: update”方法。
为此,这个修改怎么样?在这种情况下,请将请求正文包含到 requestBody
或 resource
中,如下所示。
修改后的脚本:
await drive.files.update({ fileId, requestBody: { trashed: true } });
或
await drive.files.update({ fileId, resource: { trashed: true } });
引用资料:
关于node.js - 如何使用 NodeJS 和 Google Drive API v3 将文件移动到回收站,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62360470/