Google Calendar API, Adding an event to someones calendar just by knowing their e-mail address

前端 未结 2 1712
攒了一身酷
攒了一身酷 2021-01-12 07:48

I have downloaded the Google.Apis namespace:

using Google.Apis.Auth.OAuth2;
using Google.Apis.Calendar.v3;
using Google.Apis.Calendar.v3.Data;
using Google.A         


        
2条回答
  •  时光说笑
    2021-01-12 07:59

    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()
          {
            new EventAttendee() { Email = "johndoe@gmail.com" }
          }
    };
    
    Event recurringEvent = service.Events.Insert(myEvent, "primary").Execute();
    

提交回复
热议问题