Trying to open a file from the file ID using Drive.Files.get(). Doing:
afile = Drive.Files.get({
fileID: "1LyhjPE2sQKaVJQGah_10ik_PnD5q5n6P0QlwD_XWZWc",
supportAllDrives: true
});
I get a file not found exception:
GoogleJsonResponseException: API call to drive.files.get failed with error: File not found: supportAllDrives,true,fileID,1LyhjPE2sQKaVJQGah_10ik_PnD5q5n6P0QlwD_XWZWc
The file exists and can be opened. The sharing URL is (don't worry it's a blank text file: https://docs.google.com/spreadsheets/d/1LyhjPE2sQKaVJQGah_10ik_PnD5q5n6P0QlwD_XWZWc/edit?usp=sharing
I'm probably missing something dumb here, but I've been banging my head against this. Any help would be appreciated.
In the case of "Method: files.get" of Drive API at Advanced Google service of Google Apps Script, it seems that the arguments of Drive.Files.get(fileId: string, optionalArgs: Object)
are fileId: string
and optionalArgs: Object
. So, in your script, how about the following modification?
afile = Drive.Files.get("1LyhjPE2sQKaVJQGah_10ik_PnD5q5n6P0QlwD_XWZWc", { supportsAllDrives: true });
If the file ID of your 1LyhjPE2sQKaVJQGah_10ik_PnD5q5n6P0QlwD_XWZWc
is valid file ID and Drive API has already been enabled at Advanced Google services, this script is run, the file metadata is returned.
This report might be useful. Ref (Author: me)