Google Drive Api v3 does not allow deleting files of which I am the organizer of the shared drive

Viewed 900

Basically I have a program to do few things on a shared drive. There are around 15 people uploading audio files once a day simultaneously. The account associated with the program is the owner of the shared drive where they upload the files.

The problem occurs when I tell the program to execute the function drive.files().delete(fileId=id).execute() to remove these audio files after downloading them but it raises Permissions Error.\

I tried to upload my own files and then try to remove them with the function and it does so very well.

So my conclusion is that I have to be owner of the files to deleting them, but in the Google Drive API wiki it says that a owner account of the shared drive where the files are can delete them too, so I'm very confused. "Permanently deletes a file owned by the user without moving it to the trash. If the file belongs to a shared drive the user must be an organizer on the parent.." Link: https://developers.google.com/drive/api/v3/reference/files/delete?hl=en

I don't know what to try now

1 Answers

As mentioned in the official document that you provided, If the file belongs to a shared drive the user must be an organizer on the parent... You need to have a Manager permission to delete the files not owned by you using Files.delete()

enter image description here


Note:

Don't forget to set supportsAllDrives to true when deleting files on your shared drive. drive.files().delete(fileId=id, supportsAllDrives=true).execute()

Related