0

我使用 Google Calendar API 编写我的应用程序。一切正常,但是当我尝试将重复的事件上传到 Google 时,出现错误。我不知道,有什么不好的。

代码:

EventEntry newEvent = new EventEntry();
newEvent.Title.Text = "Event title";
When time = new When(new DateTime(2013, 02, 12, 15, 0, 0), new DateTime(2013, 02, 12, 17, 0, 0));
newEvent.Times.Add(time);
Where place = new Where();
place.ValueString = "World";
newEvent.Recurrence = new Recurrence();
newEvent.Recurrence.Value = "DTSTART;VALUE=DATE:20130212T15000\r\n" +
                            "DTEND;VALUE=DATE:20130212T17000\r\n" +
                            "RRULE:FREQ=DAILY;BYDAY=Tu;\r\n";
service.Insert(query.Uri, newEvent);

在这种情况下,事件应该在星期二每周重复一次。当我运行它时,我有错误:“请求执行失败” - 但是当我评论 newEvent.Recurrence.Value... 时,一切正常,事件在谷歌日历中但没有重复:(

帮助!

4

1 回答 1

0

解决了类似的问题:如何在 Google 日历中创建“recurData”?

所以创建一个单独的重复

EventEntry myEntry = new EventEntry();
myEntry.Title.Text = "Hello recurring Event!";
// Set a location for the event.
Where eventLocation = new Where();
eventLocation.ValueString = "here and there";
entry.Locations.Add(eventLocation);

// Any other event properties

// Recurring event:
String recurData =
  "DTSTART;VALUE=DATE:20070501\r\n" +
  "DTEND;VALUE=DATE:20070502\r\n" +
  "RRULE:FREQ=WEEKLY;BYDAY=Tu;UNTIL=20070904\r\n";

Recurrence recurrence = new Recurrence();
recurrence.Value = recurData;
myEntry.Recurrence = recurrence;
于 2013-02-12T20:32:54.760 回答