且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Google Calendar API,只需知道某人的电子邮件地址即可将事件添加到某人的日历

更新时间:2023-12-04 12:57:34

在创建和插入事件的部分存在语法错误.以下是 Google API .NET 库语法正确的片段:

There are syntax errors in the part where you create the event and insert it. Here is a snippet that has correct syntax for the Google API .NET library:

Event myEvent = new Event
{
  Summary = "Appointment",
  Location = "Somewhere",
  Start = new EventDateTime() {
      DateTime = new DateTime(2014, 6, 2, 10, 0, 0),
      TimeZone = "America/Los_Angeles"
  },
  End = new EventDateTime() {
      DateTime = new DateTime(2014, 6, 2, 10, 30, 0),
      TimeZone = "America/Los_Angeles"
  },
  Recurrence = new String[] {
      "RRULE:FREQ=WEEKLY;BYDAY=MO"
  },
  Attendees = new List<EventAttendee>()
      {
        new EventAttendee() { Email = "johndoe@gmail.com" }
      }
};

Event recurringEvent = service.Events.Insert(myEvent, "primary").Execute();