2
votes

I am using https://developers.google.com/drive/v2/reference/parents/insert api to update the parent folder for a particular file.

Example -

Original Folder - A
Dest Folder - B
Root Folder - /
File - a1

After submitting a post request to the above endpoint, we see the following in the parents section of the file.

parents : [ A, B, / ]

Is it a known issue ? How can I avoid it apart from having to delete the 'root' folder manually ?

Edit: Information about the apis used.

Steps

  1. Use - drive/v2/files/%s/permissions for Adding Permission
  2. Use - drive/v2/files/%s/parents - for Inserting the parent. Set "kind", "drive#parentReference" and "id", "destfolderId" in the request

Type of account - The folder being inserted into belongs to a 'Super Admin'

1
Could you try and explain the problem a little more I don't understand. The directory structure is back ward or what?DaImTo

1 Answers

0
votes

Can't use comments due to reputation, but could you explain what you want to do a little bit more? Trying to move a file is more than just adding a new parent. Also check if root isn't already in the parent's array. Also you could use a query and list files to know what's going on more accurately. Use the built in list function in the developers page for faster access.

Links:

  1. https://developers.google.com/drive/v2/reference/files/list

  2. https://developers.google.com/drive/web/search-parameters