C# で定期的なイベントを追加したいと考えています。Web で、次のように動作することがわかりました。エントリを挿入するメソッドを実行すると、 EventEntry insertEntry = service.Insert(calendarUri, entry); で失敗します。声明 !
次のエラーが表示されます:「リクエストの実行に失敗しました: https://www.google.com/calendar/feeds/user@gmail.com/private/full?gsessionid=6eGsOTuhQ-YUVWp2BV_25g」
再発コードを削除すると、すべて正常に動作します! このコードはかなり古いことに気付きました。.NET ライブラリを使用して Google カレンダーに定期的なイベントを簡単に追加するにはどうすればよいですか?
EventEntry entry = new EventEntry();
entry.Title.Text = "Hello World !";
// Recurring event:
String recurData =
"RRULE:FREQ=WEEKLY;WKST=SU;UNTIL=20131010;BYDAY=SU\r\n";
Recurrence recurrence = new Recurrence();
recurrence.Value = recurData;
entry.Recurrence = recurrence;
string htmlDescription = "Woww, really ?";
if (htmlDescription != null && htmlDescription.Length > 0)
{
entry.Content.Type = "html";
entry.Content.Content = htmlDescription;
}
Where eventLocation = new Where();
eventLocation.ValueString = "Somewhere";
entry.Locations.Add(eventLocation);
DateTime start = DateTime.Now;
When eventTime = new When();
eventTime.StartTime = start;
DateTime endTime = DateTime.Now.AddHours(2);
eventTime.EndTime = endTime;
entry.Times.Add(eventTime);
eventTime.AllDay = true;
EventEntry insertedEntry = service.Insert(calendarUri, entry);