将现有的云端硬盘文件复制到appdata文件夹中 [英] Copy an existing Drive file into the appdata folder

查看:98
本文介绍了将现有的云端硬盘文件复制到appdata文件夹中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Drive SDK中新的 Application Data 文件夹,而不是使用创建一个新文件,如示例代码所示,我希望创建一个用户选择的模板文件的副本.我的模板文件是保存在特定云端硬盘帐户中的Google可编辑电子表格,并且可以在世界范围内读取,并且其ID在我的应用程序中配置.

I am attempting to use the new Application Data folder in the Drive SDK, but rather than creating a new file as the sample code shows, I wish to create a copy of a template file which the user selects. My template files are Google-editable spreadsheets held within a specific Drive account and are world-readable, with their IDs configured in my application.

我首先通过在

这会导致文本出现403错误

this produced a 403 error with the text

appdata文件夹中仅允许包含内容存储在云端硬盘中的文件夹或文件

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

所以我尝试将root作为第二个父级添加到parents数组中,如下所示

So I tried adding root as a second parent in the parents array, as follows

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

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

This fails again with a 403, but a slightly different error

appdata内容不支持该方法

Method not supported for appdata contents

我还尝试在创建后更新新文件的parents属性,并将新值插入到新创建文件的父级实体中,这两者都会产生相同的不支持方法"错误.

I have also tried updating the parents property of the new file after creation, and by inserting a new value into the parents entity of the newly-created file, both of which yield the same 'Method not supported' error.

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

So my question is, is it possible to create a copy of an existing field held in Drive, within a user's appdata folder? The fact that this consistently fails suggests not and that I may have to use the user's normal storage, but I would like to use the appdata folder if possible to separate my app's content from their general Drive files.

推荐答案

实际上,很遗憾,您目前无法放置实时文件 在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云端硬盘开发人员上的Cheryl Simon- https://plus.google.com/communities/107264319205603895037

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

这篇关于将现有的云端硬盘文件复制到appdata文件夹中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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