如何使用节点 js 使用 google 驱动器 api 列出 google 团队驱动器中的所有文件
How to List all the files from google team drive using google drive api with node js
如何使用 google 驱动器 api 和节点 js 列出来自 google 团队驱动器的所有文件。
我应该在此处进行哪些更改才能从团队驱动器或共享驱动器获取所有文件?
var fs = require("fs");
var path = require("path");
const credentials = require('./credentials.json');
const scopes = [
'https://www.googleapis.com/auth/drive'
];
const auth = new google.auth.JWT(
credentials.client_email, null,
credentials.private_key, scopes
);
const drive = google.drive({ version: "v3", auth });
drive.files.list({}, (err, res) => {
if (err) throw err;
const files = res.data.files;
if (files.length) {
files.map((file) => {
console.log(file);
});
} else {
console.log('No files found');
}
});```
要列出共享驱动器中的文件,您必须:
Make a request to Files: list and at the minimum set "includeTeamDriveItems" and "supportsTeamDrives" to true.
按照 this link
在 API 浏览器中尝试
如何使用 google 驱动器 api 和节点 js 列出来自 google 团队驱动器的所有文件。 我应该在此处进行哪些更改才能从团队驱动器或共享驱动器获取所有文件?
var fs = require("fs");
var path = require("path");
const credentials = require('./credentials.json');
const scopes = [
'https://www.googleapis.com/auth/drive'
];
const auth = new google.auth.JWT(
credentials.client_email, null,
credentials.private_key, scopes
);
const drive = google.drive({ version: "v3", auth });
drive.files.list({}, (err, res) => {
if (err) throw err;
const files = res.data.files;
if (files.length) {
files.map((file) => {
console.log(file);
});
} else {
console.log('No files found');
}
});```
要列出共享驱动器中的文件,您必须:
Make a request to Files: list and at the minimum set "includeTeamDriveItems" and "supportsTeamDrives" to true.
按照 this link
在 API 浏览器中尝试