Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Copy an existing Drive file into the appdata folder

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.

I first tried the copy by specifying appdata as a parent ID in the body of the copy request, as follows

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

this produced a 403 error with the text

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

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

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

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

Method not supported for appdata contents

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.

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.

like image 341
Will Abson Avatar asked Oct 04 '22 10:10

Will Abson


1 Answers

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.

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

like image 141
Jake Bolam Avatar answered Oct 10 '22 10:10

Jake Bolam