I would like to figure how to create a file within a Team drive using Google's Drive API.
Here is a reference to for files and teamdrives in google drive api's documentation.
https://developers.google.com/drive/api/v3/reference/files
https://developers.google.com/drive/api/v3/reference/files/create
https://developers.google.com/drive/api/v3/enable-shareddrives
const resource = {
name: fileName,
supportsAllDrives: true,
driveId: TEAMDRIVE_ID,
mimeType: 'application/vnd.google-apps.spreadsheet'
};
drive.files.create(
{
resource,
fields: 'id, name, webViewLink'
},
(err, file) => {
if (err) {
return({ msg: 'Failed Creating the file', err });
} else {
return file.data;
}
}
);
The code is able to create the file, but instead of it appearing in the team drive. It appears inside my personal drive. I am able to read files within my team drive. Creating files has been an issue for me though...