Google drive api 对由Google drive API创建的共享驱动器的创建权限
我正在尝试使用PHP和Javascript执行一个流程,以执行下一步: 在我的驱动器中创建共享驱动器。 将用户添加到创建的共享驱动器 但在创建驱动器的时候,我得到了它的Id,在添加权限的过程中,我得到了错误“找不到文件” 这是我的代码:Google drive api 对由Google drive API创建的共享驱动器的创建权限,google-drive-api,Google Drive Api,我正在尝试使用PHP和Javascript执行一个流程,以执行下一步: 在我的驱动器中创建共享驱动器。 将用户添加到创建的共享驱动器 但在创建驱动器的时候,我得到了它的Id,在添加权限的过程中,我得到了错误“找不到文件” 这是我的代码: return gapi.client.drive.drives.list({}) .then(function(response) { var drives = response.result.drives
return gapi.client.drive.drives.list({})
.then(function(response) {
var drives = response.result.drives;
for (let index = 0; index < drives.length; index++) {
console.log(drives[index].id);
return gapi.client.drive.permissions.create({
"fileId": drives[index].id,
"transferOwnership": true,
"resource": {
"role": "owner",
"type": "user",
"emailAddress": "mail@gmail.com"
}
})
.then(function(response) {
console.log("Response", response);
},
function(err) {
console.error("Execute error", err);
});
}
},
function(err) {
console.error("Execute error", err);
});
返回gapi.client.drive.drives.list({})
.然后(功能(响应){
var驱动器=response.result.drives;
for(让index=0;index
救救我!
谢谢你的评论 为共享驱动器创建权限需要知道两件事
“SupportSteamDrive”:true
。如果未找到,则会出现错误文件未找到
“角色”:“所有者”
和“转让所有权”:true
不是共享驱动器的有效选项。它们只能用于文件。因此,您的请求将导致错误所有者角色对于共享驱动器项无效