我有一个问题,如何使用 Google Drive API 将文件上传到 Group Drive(共享驱动器)?
我已经尝试了该文件夹(组驱动器)的父 ID,但这似乎不起作用。
public uploadFile(stream, totalSize, mime, fileName, parentId?, callback?) {
//Init upload
this.emit('progress', {
type: 'file',
name: fileName,
uploaded: 0,
size: totalSize
});
debug('Uploading file %s with parentId: %s', fileName, parentId);
//start upload
var drive = google.drive({ version: 'v3', auth: this.oauth2Client });
var fileMetadata = {
name: fileName,
mimeType: mime,
'parents': [
"0AFiiwdVdxetuUk9PVA"
],
'teamDriveId': "0AFiiwdVdxetuUk9PVA"
}
if (parentId) {
fileMetadata['parents'] = [parentId];
}
var req = drive.files.create({
resource: fileMetadata,
media: {
mimeType: …Run Code Online (Sandbox Code Playgroud) google-api node.js google-drive-api google-drive-shared-drive