I have an authenticated google client and I am wanting to list files in someone else's public folder (i think the folder being shared or not is irrelevant since it is public)
Here is my code in NodeJS
const drive = google.drive({ version: 'v3', auth });
let fconf = {};
fconf.maxResults = 10;
fconf.orderBy = "createdTime";
fconf.driveId = "xyz-badfd134343example";
fconf.includeItemsFromAllDrives = true;
fconf.q = "application/vnd.google-apps.spreadsheet";
fconf.supportsTeamDrives = true;
fconf.corpa = "drive";
fconf.supportsAllDrives = true;
drive.files.list(fconf, function(e,d)
{
console.log("e,d",e,d);
});
}
note: there is no 'folderId' option in the documentation: https://developers.google.com/drive/api/v3/reference/files/list - just a driveId option
Although I set the corpa to "drive" and Drive Id, I get the following error
{ Error: The driveId parameter must be specified if and only if corpora is set to drive.
at Gaxios.<anonymous> (/home/ubuntu/c/node_modules/gaxios/build/src/gaxios.js:73:27)
at Generator.next (<anonymous>)
at fulfilled (/home/ubuntu/c/node_modules/gaxios/build/src/gaxios.js:16:58)
at <anonymous>
at process._tickDomainCallback (internal/process/next_tick.js:228:7)
response:
{ config:
{ url: 'https://www.googleapis.com/drive/v3/files?driveId=examplexyz&includeItemsFromAllDrives=true&corpa=drive&supportsAllDrives=true',
method: 'GET',
paramsSerializer: [Function],
headers: [Object],
params: [Object],
validateStatus: [Function],
responseType: 'json' },
data: { error: [Object] },
headers:
{ 'alt-svc': 'quic=":443"; ma=2592000; v="46,43",h3-Q048=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000',
'cache-control': 'private, max-age=0',
connection: 'close',
'content-encoding': 'gzip',
'content-type': 'application/json; charset=UTF-8',
date: 'Thu, 24 Oct 2019 00:38:10 GMT',
expires: 'Thu, 24 Oct 2019 00:38:10 GMT',
server: 'GSE',
'transfer-encoding': 'chunked',
vary: 'Origin, X-Origin',
'x-content-type-options': 'nosniff',
'x-frame-options': 'SAMEORIGIN',
'x-xss-protection': '1; mode=block' },
status: 403,
statusText: 'Forbidden' },
config:
{ url: 'https://www.googleapis.com/drive/v3/files?driveId=examplexyz&includeItemsFromAllDrives=true&corpa=drive&supportsAllDrives=true',
method: 'GET',
paramsSerializer: [Function],
headers:
{ 'Accept-Encoding': 'gzip',
'User-Agent': 'google-api-nodejs-client/0.7.2 (gzip)',
Authorization: 'Bearer something',
Accept: 'application/json' },
params:
{ driveId: 'examplexyz',
includeItemsFromAllDrives: true,
corpa: 'drive',
supportsAllDrives: true },
validateStatus: [Function],
responseType: 'json' },
code: 403,
errors:
[ { domain: 'global',
reason: 'teamDriveIdRequiresTeamDriveCorpora',
message: 'The driveId parameter must be specified if and only if corpora is set to drive.' } ] } undefined
close the queue { success: true }