0

I am searching for sample code which allow me to delete a google drive file from the app folder. I am using google play service api. I don't see any documentation on how to remove a file from the app folder. I am using google play service 6.5 I have tried the

mDrive.files().delete(fileId).execute();

this does not work. I am getting permission error for the the file.

Raptor
  • 53,206
  • 45
  • 230
  • 366
  • Okay, permission error. So, do you obtain the permission ? – Raptor Feb 12 '15 at 07:02
  • possible duplicate of [Trash, Delete in new Google Drive Android API?](http://stackoverflow.com/questions/21369573/trash-delete-in-new-google-drive-android-api) – Daniel May 29 '15 at 06:37

2 Answers2

0

I believe, you mixed 2 different API's. AFAK, the app folder is something introduced in Google Drive Android API (GDAA), which HAS NO DELETE as of yet. The formulation I see above is coming from another API, so called RESTful API, that does not have app folder equivalent. Also, beware that there are 2 different file/folder IDs involved here. DriveId used only in the GDAA, and ResourceID (aka Id) in the RESTful API. You can grab the ResourceId from the GDAA and try to apply it to the REST (this may be what you're doing, it is not clear from your one-liner above), but I don't think REST will let you do that. I myself don't have time, but you may try to test it:

  1. Create app folder file, get DriveId
  2. Turn it into ResourceId
  3. Apply to your code above (fileId)

... and you will likely end up with something like the error you're complaining about. Sorry, I did not help much, but I believe there isn't an easy solution to this. The link to SO 21369573 may give you an idea how to hack it. Good Luck.

Community
  • 1
  • 1
seanpj
  • 6,735
  • 2
  • 33
  • 54
0

Delete is available in the Google Drive Android API as of Google Play services 7.5: https://developers.google.com/drive/release-notes#drive_android_api_google_play_services_75_-_may_28th_2015

Please try that method and update this question if you are still receiving a permission error.

Daniel
  • 1,239
  • 1
  • 13
  • 24