我正在Google Calendar API v3
上测试.Net
。我已成功将事件添加到日历中,如下所示:
Google.Apis.Calendar.v3.Data.EventAttendee attendee = new Google.Apis.Calendar.v3.Data.EventAttendee();
attendee.Email = "[email]@gmail.com";
List<Google.Apis.Calendar.v3.Data.EventAttendee> event_attendees = new List<Google.Apis.Calendar.v3.Data.EventAttendee>();
event_attendees.Add(attendee);
Google.Apis.Calendar.v3.Data.Event new_event = new Google.Apis.Calendar.v3.Data.Event();
new_event.Summary = "GoogleCalendarTest: Testing Event 4";
new_event.Description = "Testing .Net Google Calendar API";
new_event.Location = "Offices";
new_event.Start = new Google.Apis.Calendar.v3.Data.EventDateTime();
new_event.Start.DateTime = DateTime.Now;
new_event.End = new Google.Apis.Calendar.v3.Data.EventDateTime();
new_event.End.DateTime = new DateTime(2014, 12, 15, 12, 0, 0);
new_event.Attendees = event_attendees;
service.Events.Insert(new_event, "[email]@gmail.com").Execute();
我认为这会自动向与会者发送邀请电子邮件,但默认情况下它似乎不会在documentation中显示。添加的sendNotifications
参数是一个可选参数,此question显示了PHP
的完成情况,但我无法确定如何在{{1}上添加此参数}}
更新
找出在.Net
上设置sendNotifications
的方法:
.Net
但仍然没有发送邀请电子邮件,可能仍然在做错事。
更新2
版本问题?
我发现了这个问题:Google Calendar API for .Net: Email notifications not sent when creating calendar event,这与我遇到的问题非常相似。卸载和安装API解决了这个问题...我试过这个但仍然有同样的问题,currrent版本:1.9.0
答案 0 :(得分:3)
这对我有用:
EventsResource.InsertRequest request = service.Events.Insert(newEvent, "primary");
request.SendNotifications = true;
Event createdEvent = request.Execute();