[英]Can Apps Scripts Google Drive API talk with Shared Drives
总而言之,我在我的 Apps 脚本中使用 Google Drive API 和共享驱动器时遇到了问题。 当我运行下面的代码时,我收到错误“GoogleJsonResponseException: API call to drive.permissions.insert failed with error: File not found.”
相同的代码适用于“我的云端硬盘”上的文件,因此这是共享云端硬盘的问题。 代码以我自己的身份运行,我是共享驱动器的所有者。 有任何想法吗?
function insertPermission() {
var resource = {
// enter email address here
value: 'xxxxxxxxx@xxxxxxx.com',
// choose from "user" or "group" if using a Google Group
type: 'user',
// choose from: "owner", "writer" or "reader"
role: 'writer'
};
var optionalArgs = {
sendNotificationEmails: false
};
Drive.
Drive.Permissions.insert(resource, 'TokenIDGoesHere', optionalArgs);
}
你好 ! 您需要将请求参数supportsAllDrives
设置为true
,以便能够向共享驱动器发出此类请求。
我希望这对你有所帮助。 让我知道您是否需要其他任何内容,或者您是否不理解某些内容。 :)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.