[英]Google Drive API doesn't show shared files
I need list files shared with me on Google Drive API, but from yesterday to now i'm trying but without success.我需要在 Google 云端硬盘 API 上与我共享的列表文件,但从昨天到现在我一直在尝试但没有成功。 I have this single code:
我有这个单一的代码:
const auth = new google.auth.JWT({
email: 'xxxxxx@xxxxxx-322013.iam.gserviceaccount.com',
key: '-----BEGIN PRIVATE KEY-----\nfkdajlsfçdklasf-\n',
scopes: [
'https://www.googleapis.com/auth/documents',
'https://www.googleapis.com/auth/drive.file',
],
});
// shared file (owned by regular user and shared with the API service account email)
const template = '1xcy8PjkRVzjZ-E7jY6gJtSyvSXlCbNyqEYrVS-3nQIY';
const drive = google.drive({
version: 'v3',
auth,
});
// entire shared folder (owned by regular user and shared with the API service account email)
const folderId = '1j0y8rttjNe4JecDH065L9GwEKw_a_nmC';
const filesDrive = await drive.files.list({
supportsAllDrives: true,
includeItemsFromAllDrives: true,
});
console.log(filesDrive);
I have tried many combination of parameters, but the shared file never is displayed in the filesDrive object.我尝试了多种参数组合,但共享文件从未显示在 filesDrive object 中。
In the next steps i want to copy the file to the API google drive and replace a few words using docs.在接下来的步骤中,我想将文件复制到 API 谷歌驱动器并使用文档替换几个词。
Thanks a lot非常感谢
I had the same issue, I had to share the folder with the service account email (client_email).我有同样的问题,我不得不与服务帐户 email (client_email) 共享文件夹。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.