I'm trying to do a small application that reads a shared folder with different users of my organization, get the files and then delete them.
The problem is that I can't delete the file of a different user, because I can only delete files of my ownership (receiving a 403 Insufficient permissions for this file)
Another solution I found is change the owner of the file, but I get the same error.
I test it with a Native Application oAuth with a SuperAdmin account of the organization and with a service account, and none of them works.
A piece of my code trying to change the ownership:
new_permission = {
'value': "admin@organization.com",
'type': "user",
'role': "writer"
}
perm = drive_service.permissions().insert(fileId=idfield, body=new_permission).execute()
perm['role'] = 'owner'
drive_service.permissions().update(fileId=idfield, permissionId=perm['id'], transferOwnership=True, body=perm).execute()
I spend hours searching and trying different solutions I found, but no one works (for example, Transfer ownership of a file fails - even as Super Administrator (Google Drive API, Java)).
Somebody has some idea? Thanks!