I want to send notification when deleting an event :
var certificate = new X509Certificate2("myp12filepath", "notasecret", X509KeyStorageFlags.Exportable | X509KeyStorageFlags.MachineKeySet);
ServiceAccountCredential credential = new ServiceAccountCredential(
new ServiceAccountCredential.Initializer(serviceAccountEmail)
{
Scopes = Scopes
}.FromCertificate(certificate));
BaseClientService.Initializer initializer = new BaseClientService.Initializer();
initializer.HttpClientInitializer = credential;
initializer.ApplicationName = ApplicationName;
var service1 = new CalendarService(initializer);
var googleCalendarEvent = service1.Events.Delete("calendarId", "eventId").Execute();
The delete function does not accept a third parameter (indicating whether or not to send a notification) as mentioned in this link (there is no c# example)
So is there a way to send email notifications after deleting an event?
Create an instance of delete request and assign notification as true. See below.
var certificate = new X509Certificate2("myp12filepath", "notasecret", X509KeyStorageFlags.Exportable | X509KeyStorageFlags.MachineKeySet);
ServiceAccountCredential credential = new ServiceAccountCredential(
new ServiceAccountCredential.Initializer(serviceAccountEmail)
{
Scopes = Scopes
}.FromCertificate(certificate));
BaseClientService.Initializer initializer = new BaseClientService.Initializer();
initializer.HttpClientInitializer = credential;
initializer.ApplicationName = ApplicationName;
var service1 = new CalendarService(initializer);
EventsResource.DeleteRequest delReq = service1.Events.Delete("calendarId", "eventId");
delReq.SendNotifications = true;
var googleCalendarEvent = delReq.Execute();
AFAIK, you need to set sendNotifications
to true
if you want to send notifications about the deletion of the event as also mentioned in your given link . And in addition to that, for a user to receive notifications, user's notification setting should also be checked for each of the calendars as mentioned in this forum and also as given here .
Listed below are the steps to turn notification on or off:
You can choose whether to have notifications for events, and whether you want to get notifications over email or in your browser.
- Open Google Calendar on your computer.
- In the top right, click Settings (gear icon) > Settings .
- At the top of the page, click the Calendars tab.
- Next to your calendar's name, click Edit notifications .
- Click Add notification or edit an existing notification.
- At the bottom of the page, click Save .
Note : To get notifications on your computer, you need to have Google Calendar open in your browser.
Lastly, since there is not much sample for C#, the .NET client might help.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.