google-drive-api - 将现有的 Drive 文件复制到 appdata 文件夹中

标签 google-drive-api

我正在尝试使用新的 Application Data Drive SDK 中的文件夹,但不是如示例代码所示创建新文件,我希望创建用户选择的模板文件的副本。我的模板文件是保存在特定 Drive 帐户中的 Google 可编辑电子表格,全世界都可读,它们的 ID 在我的应用程序中配置。

我首先通过指定 appdata 来尝试复制。作为 copy request 正文中的父 ID , 如下

{
  "title": "New file",
  "parents": 
  [
    {
      "id": "appdata"
    }
  ]
}

这对文本产生了 403 错误

Only folders or files with content stored in Drive are allowed within the appdata folder



所以我尝试添加 root作为 parents 中的第二个父级数组,如下
{
  "title": "New file",
  "parents": 
  [
    {
      "id": "appdata"
    },
    {
      "id": "root"
    }
  ]
}

这再次失败并显示 403,但错误略有不同

Method not supported for appdata contents



我也尝试更新 parents创建后新文件的属性,并通过将新值插入新创建文件的父实体中,这两者都会产生相同的“不支持方法”错误。

所以我的问题是,是否可以在用户的​​ appdata 文件夹中创建云端硬盘中现有字段的副本?这始终失败的事实表明不是,我可能不得不使用用户的正常存储,但如果可能的话,我想使用 appdata 文件夹将我的应用程序的内容与其通用驱动器文件分开。

最佳答案

Actually, unfortunately you cannot currently place a realtime file within the appdata folder. This is something we are looking at adding, but in most cases it doesn't make sense since the content of the appdata folder is restricted to a single user.



Google Drive Developers 上的 Cheryl Simon - https://plus.google.com/communities/107264319205603895037

关于google-drive-api - 将现有的 Drive 文件复制到 appdata 文件夹中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15961017/

相关文章:

javascript - google drive sdk - 如何通过 JavaScript 上传一个简单的文件

Android Google Play/Drive Api

google-drive-api - 如何使用 Google Drive API 搜索自定义文件属性?

java - 无法打开通过 java google-drive-sdk 共享的文件,除非用户首先通过 drive.google.com 打开文件

reactjs - 如何使用 gapi 将图像上传到谷歌驱动器并使用react

google-apps-script - 按名称打开 Google 文档电子表格

java - Google 云端硬盘网络 Hook 配置

javascript - 使用变量在 Google Drive API 中搜索文件

web - 如何将统一网络播放器游戏上传到 Google Drive?

google-drive-api - 获取google drive文件下载地址