As a google driver user (using my gmail account) I want to transfer ownership of my uploaded files to another user (using their gmail account).
I found this handy tool: https://github.com/davidstrauss/google-drive-recursive-ownership , which makes this call:
service.permissions().update(fileId=drive_item['id'],
permissionId=permission_id, body=permission, transferOwnership=True).execute()
I've verified the fileId is correct and the permission_id is correct, along with the permission object that is being passed in as the body.
The code seems good, and it runs great against google drive "native" files (like the google docs and spreadsheets).
But when run against an uploaded PDF, this error occurs:
<HttpError 403 when requesting https://www.googleapis.com/drive/v2/files/0Bxz4bvKt4QekTWlUUHg0XzUydTa/permissions/18055737357773114524
?transferOwnership=true&alt=json returned "Insufficient permissions for this file">
Any ideas on why changing ownership of "native" google drive files works fine when using the 'update' method but changing ownership of uploaded files (like PDFs and docx files) doesn't?
Move file – In Google Drive each file can have only one parent folder. By default when changing ownership to a new owner MyDrive a shortcut is created to the original file (this preserves permissions inherited from the folder where the file was placed).
If you want to transfer ownership of a folder to a new user, the first step is to enter the admin console. Now that you’re in the admin console, first enter the “apps” section. This will let you access all Google Apps, such as Google Docs and Drive. In the admin console, the “apps” section contains all Google Apps, including Google Docs and Drive.
If your company is using the Enterprise version of Google Workspace (formerly G Suite), but your contractor isn’t on that same account, there is no direct way to change the owner of their files and you have to use work-arounds that leave the job half done. There are exceptions to this.
GAT+ provides the Admins of the domain to perform and take many actions on Drive and Email audit of the domain. One of the options available is the functionality given to the Admin to change the Drive file ownership from one user to another. Navigate to GAT+ > Drive > apply filter and find the file needed.
Changing the ownership of non-Google docs within Google drive can only be done with a Google Apps account, not a regular Google account.
So in order for your script to work, you either need to use a Google Apps account for authentication or there's a few messy workarounds below;
https://productforums.google.com/forum/#!topic/drive/Hz1uUukwKmk https://productforums.google.com/forum/#!topic/drive/VPhNE_HkGLs
Check whether it is a prevent flag issue . Right click and select shares and try to see if stops you from making any further shares to other people . A file that is shared with somebody with a setting that people with whom it is shared with cannot share it , then you will get insufficient permission errors .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With