I am using PyDrive to create a Google Sheets file on a Google Shared Drive, the below code snippet successfully creates the file in my shared drive folder:
f = gd.CreateFile(
{'title': name, 'mimeType': 'application/vnd.google-apps.spreadsheet', 'parents': [{'teamDriveId': '1234', 'id': '1234'}]})
f.Upload(param={'supportsTeamDrives': True})
On adding the file, I am also trying to set permissions for an email address to gain write access to the file as below:
f.InsertPermission({'type': 'user', 'value': 'myemail@email.com', 'role': 'writer'})
On attempting to add the permissions, I receive the below error:
<HttpError 404 when requesting https://www.googleapis.com/drive/v2/files/file_id_here/permissions?alt=json returned "File not found: file_id_here">
I have checked and the file id appears to be the same as the one that has been created.
I assumed that it wouldn't be any authorisation issue if I am able to create the file? Any suggestions would be very much appreciated.
Thanks