[英]Upload events to Google API Calendar
我使用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 ...时,一切正常,事件在Google日历中,但未重复:(
救命!
解决了类似的问题: 如何在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;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.