Google Calendar API for .Net: Email notifications

2019-08-07 07:26发布

问题:

I'm working on a windows service that uses the Google Calendar API v3 to create and delete calendar events. My code is working, but when creating new events, email notifications never get sent to the invitees. The events just show up on their calendar.

Here is a code snippet:

EventsResource.InsertRequest insertRequest = new EventsResource.InsertRequest(calendarService, eventRequest, calendarID);
insertRequest.SendNotifications = true;
var response = insertRequest.Execute();

I have tested creating the same events using the same authentication credentials using the Google Calendar API explorer:

https://developers.google.com/google-apps/calendar/v3/reference/events/insert#try-it

When I create the event using that form, email notifications are sent out correctly, so I don't think it's a configuration or authentication problem on the Google side. I'm starting to think this is a bug in the Google API for .Net (I'm using the latest version - 1.8.1.95). I'm setting SendNotification property to true, but maybe it's not getting added to the actual request that goes out?

Anyone else having this problem?

回答1:

try with this:

Event EventNew = new Event();
/*Complete the event*/
EventNew.Summary = "test";
EventNew.Description = ....
EventNew. ......

 EventsResource.InsertRequest request = CalendarioGoogle.Events.Insert(EventNew,calendarID);

request.SendNotifications = true;


/*In this case result is a Event*/
result = request.Execute();