google-apps-script - 在 Google AppScripts 中,我们如何为共享驱动器中的文件夹添加内容管理器权限?
问题描述
在 AppScripts API 参考中,为文件夹添加权限有两个设置:addEditor(emailAddress) 和 addViewer(emailaddress)。无论如何,我们可以使用 AppScripts 在文件夹上添加“内容管理器”权限吗?
解决方案
Google Drive API 有一个通用方法可以授予组权限,请参阅setSharing(accessType, permissionType)
:
// Creates a folder that anyone on the Internet can read from and write to. (Domain
// administrators can prohibit this setting for users of a Google Workspace domain.)
var folder = DriveApp.createFolder('Shared Folder');
folder.setSharing(DriveApp.Access.ANYONE, DriveApp.Permission.EDIT);
权限包括编辑、查看、组织等...
参考:
推荐阅读
- nginx - NGINX 不会在自定义目录中提供 html
- node.js - 开玩笑 - 多个 websocket 连接挂起开玩笑
- google-apps-script - 带有复选框的许多不同列的确认警报消息,并在勾选复选框时自动将时间戳输入到几列
- python - (FEniCS) 运行时错误 Uable to cast Python instance to C++ type (complied in debug mode for details)
- java - Android 9 及更低版本在不退出应用程序的情况下无法连接到未配置的 wifi 网络
- raspberry-pi - 包“git”的文件列表文件包含空文件名错误
- amazon-web-services - 如何在 Elastic Beanstalk 单实例环境中将 HTTP 重定向到 HTTPS
- c# - 无法打破 C# 中的无限 While 循环
- python - 在 python 中制作视频的顺序播放列表
- mysql - 错误:MySQL 意外关闭这可能是由于端口阻塞,缺少依赖项