Search code examples
pythonrestgoogle-drive-apigoogle-drive-shared-drive

Google REST API Support Team Drive Isn't Working


I'm trying to replace a file that's currently in a Team Drive folder with a new version. I have the following basis python function:

self.service.files().create(body=meta, media_body=media_body).execute()

This function works wonderfully for normal Google Drive files, but for the one(s) in Team Drive, I get a 404 "File not found" error.

I suspect this has to do with needing supportTeamDrives as mentioned here: https://developers.google.com/drive/api/v3/enable-teamdrives

However, if I do:

self.service.files().create(body=meta, media_body=media_body,
                            supportTeamDrive=True).execute()

I get the error Got an unexpected keyword argument "supportTeamDrive". And if I try to put it in the body dictionary, I just get the same 404 error.

Why isn't this working, and how do I fix it to support Team Drive?


Solution

  • Minor typo -- the paramater is supportsTeamDrives, not supportTeamDrives. I've made this mistake too :)