В моем основном приложении asp.net я собираюсь добавить новое событие в календарь Google.Но это показывает ошибку в Google.Я включил API календаря и вставил ClientId и ClientSecret.Но он показывает ошибку.
Это мой код ниже. и
public void CreateEvent(string email, string text)
{
UserCredential credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
new ClientSecrets
{
ClientId = "461480317556-xxxxxxxxxxg.apps.googleusercontent.com",
ClientSecret = "RljgIL79D2YFkmVaWQypCjIa",
},
new[] { CalendarService.Scope.Calendar },"user",CancellationToken.None).Result;
// Create the service.
var service = new CalendarService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = "Calendar API Sample",
});
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 = email } }
};
Event recurringEvent = service.Events.Insert(myEvent, "primary").Execute();
}