Google drive disable permission change notification

I want to disable email notification in my C # application if permissions are changed. I found a service.permissions.insert property called SendNotificationEmails, but I don't know how to use it. I tried Avoid email notification of permission to drive on disk

my code is: return service.Permissions.Insert (newPermission, fileId) .SendNotificationEmails (Boolean.TrueString) .execute ();

but I get an error: "invaable member" Google.Apis.Drive.v2.PermissionsResource.InsertRequest.SendNotificationEmails' cannot be used as a method "

thanks! Markus

+4
source share
2 answers

SendNotificationEmails is a field, not a method. Use the following instead:

 InsertRequest req = service.Permissions.Insert(newPermission, fileId); req.SendNotificationEmails = true; req.Fetch(); 
+9
source

There is no need to answer Burke's question.

Just change the code to

 return service.Permissions.Insert(newPermission,fileId).setSendNotificationEmails(false).execute(); 

This will make the work just as good and much shorter.

0
source

Source: https://habr.com/ru/post/1497809/


All Articles