How to move a file from MyDrive to Team Drive?

后端 未结 1 691
天涯浪人
天涯浪人 2021-01-29 03:06

I would like to use Google Apps Script to transfer a file from MyDrive to Team Drive. I can do this manually (so I know I have permission) and I enabled the Drive API (so was a

1条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-29 03:41

    It appears I was overthinking it as the following works:

    var file = DriveApp.getFileById(fileId);
    var parentFolder = DriveApp.getFolderById(TEAM_DRIVE_ID);
    parentFolder.addFile(file);
    

    0 讨论(0)
提交回复
热议问题