1

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);
4

2 に答える 2

1

Google から直接 (デフォルトで表示されない場合は、.NET の例をクリックしてください):定期的なイベントの作成

うまくいけば、これがあなたの質問に完全に答えない場合でも、いくつかのアイデアを提供します。

乾杯。

于 2013-02-27T01:56:25.740 に答える
1

いつ終了するかを伝える繰り返し文字列には、フルタイムのエントリが必要です。UNTIL=20131010 と言っただけです。問題は 20131010 どこですか? 真夜中が必要だと想定できますが、それでは... 真夜中はどこですか?

String recurData =
"RRULE:FREQ=WEEKLY;WKST=SU;UNTIL=20131010T000000-05:00;BYDAY=SU\r\n";

上記の変更により、2013 年 10 月 10 日の米国東部時間の深夜までイベントが繰り返されるようになります。

于 2013-02-27T02:12:03.393 に答える