Reputation: 105
Need to know how to do the same in shared drive.
I was able to create a subfolder in my drive using:
file_metadata = {
'supportsAllDrives':True,
'parents': ['twLBZwLdxfBKTEX0VUUr6'],
'name': "new folderrrrr sub",
'mimeType': 'application/vnd.google-apps.folder',
}
file = DRIVE.files().create(body=file_metadata,
fields='id', supportsAllDrives=True, supportsTeamDrives=True).execute()```
Upvotes: 1
Views: 1048
Reputation: 2598
I grasp that you want to upload a folder filled with files in a shared drive. If that isn't your question, please forgive me. To accomplish that you'll need editing permission to be able to write into that shared drive. With that on mind, your operation can be divided into two steps:
parents[]
you have to use the id
property of the shared drive (you can get it by using the LIST
method).For both operation you must use the CREATE
method with the supportsAllDrives
parameter set to true
(this requirement is only needed until the first of June of 2020 as described on the linked documentation). You can read here how to set up a working Drive API environment for Python if you don't have one already. If you have any doubt or request additional help, please don't hesitate to comment on my answer.
Upvotes: 1