云端硬盘权限的每次更改都会发送一封通知邮件。有没有办法避免这种情况?
提前非常感谢, Ridgh
Whenever you insert a new permission with the Drive API, you can set the sendNotificationEmails
optional parameter to false to avoid sending that email:
https://developers.google.com/drive/v2/reference/permissions/insert
以下是在 Java 中有效的方法:
service.permissions().insert(fileId, newPermission).setSendNotificationEmails(false).execute();
在 c# (api v3) 上,您必须在创建请求后将 SendNotificationEmail 设置为 false;
var req = _driveService.Permissions.Create(
new Permission
{
Role = "reader",
Type = "user",
EmailAddress = readerEmail
}, document.DocumentId);
req.SendNotificationEmail = false;
req.Execute();
PHP语言的解决方案:
$this->service->permissions->create($folder->id, $userPermission, array('fields' => 'id', 'sendNotificationEmail' => false));