I am trying to move a file from one folder in a Google shared (team) drive to another folder in the same drive. I have used the following code in non-shared drive successfully, but when I try to use it in a shared drive, I get an error
Exception: Cannot use this operation on a share drive item. (line x, file "Code")
function moveFile(fileID, folderID) {
var file = DriveApp.getFileById(fileID).makeCopy();
DriveApp.getFolderById(folderID).addFile(file);
}
I can't find any documentation on why shared drives behave differently. I would love either education on why shared drives are different and/or alternative code which achieves my needs.
(I know this code misses details like renaming the file and removing the copy from the original directory... those are easy to solve, so I don't want to complicate this question.)