更新Google日历-插入/删除事件

时间:2018-07-09 20:19:27

标签: c# google-api google-calendar-api

我需要帮助才能在Google日历中创建一个新活动。我遵循了link

及其正常工作,但是现在我需要添加新事件并删除事件(现有/新),但我无法弄清楚如何添加事件。我尝试通过以下示例在日历中插入新事件:link

但是当我编译时,它给了我一个错误,这是屏幕截图。

enter image description here我将非常感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

要添加新活动并发送邀请:

    Event myEvent = new Event
        {
            Summary = "Discussion on new project",
            Location = "Mentor",
            Start = new EventDateTime()
            {
                DateTime = new DateTime(2018, 8, 16, 10, 0, 0),
                TimeZone = "America/Los_Angeles"
            },
            End = new EventDateTime()
            {
                DateTime = new DateTime(2018, 8, 16, 11, 30, 0),
                TimeZone = "America/Los_Angeles"
            },
            Recurrence = new String[] { "RRULE:FREQ=WEEKLY;BYDAY=MO"},
            Attendees = new List<EventAttendee>()
  {
    new EventAttendee() { Email = "abc@gmail.com" }
  }
        };

 var recurringEvent = service.Events.Insert(myEvent, "primary");
        recurringEvent.SendNotifications = true;
        recurringEvent.Execute();