public function shareGoogleSheet(Google_Service_Drive $service, string $email, array $role, string $spreadsheetId, string $name)
{
$newPermission = new Google_Service_Drive_Permission();
$newPermission->setEmailAddress($email);
$newPermission->setType(self::SHARED_TYPE);
$newPermission->setRole($role);
try {
$service->permissions->create($spreadsheetId, $newPermission);
} catch (\Exception $e) {
$this->logger->error($name . $e->getMessage());
}
}
The Code that's I'm using for sharing the mails. Now I configured the service account for sharing the mails...
In the end the problem you are facing has nothing to do with the API and more with the configuration of your domain.
Contact the administrator so he can change the settings: