我有此代码:
var params = {
supportsTeamDrives: true,
includeTeamDriveItems: true
};
var pageToken
folders = Drive.Files.list({
q: "title = 'ADSD'",
maxResults: 100,
pageToken: pageToken,
params: {
supportsTeamDrives: true,
includeTeamDriveItems: true
}
});
但是结果是
{kind=drive#fileList, etag="8xUCra6FbWx8e1S7QPWn-stRIsE/skD00QgZZ0FB6U5ufzrrxrFjqyA", incompleteSearch=false, items=[], selfLink=https://www.googleapis.com/drive/v2/files?maxResults=100&q=title+%3D+'ADSD'&alt=json}
但是,如果我在此处执行相同的请求:
https://developers.google.com/drive/api/v2/reference/files/list?authuser=1&apix_params=%7B%22includeTeamDriveItems%22%3Atrue%2C%22q%22%3A%22title%20%3D%20%27ADSD%27%22%2C%22supportsTeamDrives%22%3Atrue%7D#examples
我有这个自我链接:
"selfLink": ["https://www.googleapis.com/drive/v2/files?includeTeamDriveItems=true&q=title+%3D+'ADSD'&supportsTeamDrives=true"][1]
其中includeTeamDriveItems和supportsTeamDrives设置为true
我不知道这是否是一个请求成功(您尝试使用API的请求)而另一个请求却不成功(在Google App脚本上)的原因。
出于记录,我启用了Google云端硬盘高级服务。
答案 0 :(得分:0)
我找到了答案。参数必须在请求中,而不能在“参数”中。
var pageToken
do {
folders = Drive.Files.list({
pageSize: 10,
//fields: 'nextPageToken, files(id, name)',
includeTeamDriveItems: true,
supportsTeamDrives: true,
q: "title = 'ADSD'"
});
/*
if (folders.items && folders.items.length > 0) {
for (var i = 0; i < folders.items.length; i++) {
var folder = folders.items[i];
Logger.log('%s (ID: %s)', folder.title, folder.id);
}
} else {
Logger.log('No folders found.');
}*/
Logger.log(folders);
pageToken = folders.nextPageToken;
//Logger.log(pageToken);
} while (pageToken);