如何使用创建方法禁用 sendNotificationEmails?
How to disable sendNotificationEmails using create method?
我正在使用 PHP Google 驱动器 API V2,我想在使用 create 方法授予权限时停止发送通知电子邮件.下面是我的代码:
foreach($EMAILS as $cnt=>$email){
$userPermission = new Google_Service_Drive_Permission(array(
'type' => 'user',
'role' => 'writer',
'emailAddress' => $email
));
$request = $driveService->permissions->create(
$fileId, $userPermission, array('fields' => 'id'));
$batch->add($request, 'user');
$results[] = $batch->execute();
}
有什么帮助吗?
在本 V2 文档中,我找不到 create
权限方法:
https://developers.google.com/resources/api-libraries/documentation/drive/v2/php/latest/class-Google_Service_Drive_Permissions_Resource.html
对于 $optParams
参数,你有这个:
Opt_param
string emailMessage A plain text custom message to include in the notification email.
bool sendNotificationEmail Whether to send a notification email when sharing to users or groups. This defaults to true for users and
groups, and is not allowed for other requests. It must not be disabled
for ownership transfers.
bool supportsTeamDrives Whether the requesting application supports Team Drives.
bool transferOwnership Whether to transfer ownership to the specified user and downgrade the current owner to a writer. This
parameter is required as an acknowledgement of the side effect.
bool useDomainAdminAccess Whether the request should be treated as if it was issued by a domain administrator; if set to true, then the
requester will be granted access if they are an administrator of the
domain to which the item belongs.
您只需在该参数数组中将 sendNotificationEmail 发送为 false。
'sendNotificationEmails'=>false
我正在使用 PHP Google 驱动器 API V2,我想在使用 create 方法授予权限时停止发送通知电子邮件.下面是我的代码:
foreach($EMAILS as $cnt=>$email){
$userPermission = new Google_Service_Drive_Permission(array(
'type' => 'user',
'role' => 'writer',
'emailAddress' => $email
));
$request = $driveService->permissions->create(
$fileId, $userPermission, array('fields' => 'id'));
$batch->add($request, 'user');
$results[] = $batch->execute();
}
有什么帮助吗?
在本 V2 文档中,我找不到 create
权限方法:
https://developers.google.com/resources/api-libraries/documentation/drive/v2/php/latest/class-Google_Service_Drive_Permissions_Resource.html
对于 $optParams
参数,你有这个:
Opt_param
string emailMessage A plain text custom message to include in the notification email.
bool sendNotificationEmail Whether to send a notification email when sharing to users or groups. This defaults to true for users and groups, and is not allowed for other requests. It must not be disabled for ownership transfers.
bool supportsTeamDrives Whether the requesting application supports Team Drives.
bool transferOwnership Whether to transfer ownership to the specified user and downgrade the current owner to a writer. This parameter is required as an acknowledgement of the side effect.
bool useDomainAdminAccess Whether the request should be treated as if it was issued by a domain administrator; if set to true, then the requester will be granted access if they are an administrator of the domain to which the item belongs.
您只需在该参数数组中将 sendNotificationEmail 发送为 false。
'sendNotificationEmails'=>false