如何使用NodeJS和Google Drive API v3将文件移至回收站 [英] How to move file to trash using NodeJS and Google Drive API v3

查看:2437
本文介绍了如何使用NodeJS和Google Drive API v3将文件移至回收站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用NodeJS和Google Drive API v3将文件移至垃圾箱.以下行不起作用:

How to move a file to trash using NodeJS and Google Drive API v3. Below lines are NOT working:

await drive.files.update({ fileId, trashed: true }); // not working
await drive.files.update({ fileId },  { trashed: true }); // not working

推荐答案

我相信您的情况和目标如下.

I believe your situation and goal as follows.

  • 您要使用带有Node.js的googleapis的Drive API v3将文件移至垃圾箱.
  • drive 可以用于使用Drive API的文件:更新"方法.
  • You want to move a file to the trash box using Drive API v3 with googleapis with Node.js.
  • drive can be used for using the method of "Files: update" of Drive API.

为此,该修改如何?在这种情况下,请将请求正文包含在 requestBody resource 中,如下所示.

For this, how about this modification? In this case, please include the request body to requestBody or resource as follows.

await drive.files.update({ fileId, requestBody: { trashed: true } });

await drive.files.update({ fileId, resource: { trashed: true } });

参考文献:

  • 用于Node.js的googleapis
  • 文件:更新
  • 这篇关于如何使用NodeJS和Google Drive API v3将文件移至回收站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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