node.js - 如何使用 NodeJS 和 Google Drive API v3 将文件移动到回收站

标签 node.js google-api google-drive-api google-api-nodejs-client

如何使用 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”方法。

为此,这个修改怎么样?在这种情况下,请将请求正文包含到 requestBodyresource 中,如下所示。

修改后的脚本:

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/

相关文章:

c# - 如何安全地存储 google drive api 提供的每个用户的 OAuth 响应文件

Android - Google Drive API 实现错误

javascript - 当我将路由放入 Controller 时,我的控制台出现错误

google-api - 如何将Google Drive视频导入同一YouTube帐户?

python - 使用 Python 中的请求将文件上传到 Google 云端硬盘

go - 在 Go 中使用 google oauth2

javascript - Chrome 调试协议(protocol) : Create local storage value

node.js - aws-sdk 上传到 S3 在 KOA 中可以工作,但通过 Mocha 调用时会停止工作

node.js - 无法使用 Node.js 和 Heroku 将文件上传到文件夹中

javascript - 谷歌应用脚​​本: "Missing ' ;' before statement"