c# - 如何在谷歌日历中创建 "recurData"?

标签 c# google-calendar-api icalendar

我想使用 Google API 创建日历的周期性事件。 我正在关注链接:

  1. Google Calendar API

    我不知道如何创建“recurData”。 我无法修改 String 并将其作为参数传递。 也尝试了 DDay.iCal 版本 0.80。

  2. DDay.iCal

给出了一些示例代码。我试过了。 我能够创建“.ics”文件。

但是当我将此文件内容作为“recurData”传递时

获取错误: {“请求执行失败:http://www.google.com/calendar/feeds/user@domain.com/private/full?gsessionid=AHItK5wrSIoJVawFjGt-0g”}

我的 icf 文件内容是:

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//DDay.iCal//NONSGML ddaysoftware.com//EN
BEGIN:VEVENT
CREATED:20100309T132930Z
DESCRIPTION:The event description
DTEND:20100310T020000
DTSTAMP:20100309T132930Z
DTSTART:20100309T080000
LOCATION:Event location
SEQUENCE:0
SUMMARY:18 hour event summary
UID:396c6b22-277f-4496-bbe1-d3692dc1b223
END:VEVENT
BEGIN:VEVENT
CREATED:20100309T132930Z
DTEND;VALUE=DATE:20100315
DTSTAMP:20100309T132930Z
DTSTART;VALUE=DATE:20100314
SEQUENCE:0
SUMMARY:All-day event
UID:ac25cdaf-4e95-49ad-a770-f04f3afc1a2f
END:VEVENT
END:VCALENDAR

我是用“Example6”做的。

最佳答案

它认为这个示例会告诉我们,您使用 EventEntry 类创建日历条目。然后将重复传递给该条目。

在谷歌的示例中,DTSTART 和 DTEND 字段代表重复的开始和结束。

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;

关于c# - 如何在谷歌日历中创建 "recurData"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2409483/

相关文章:

c# - C#正则表达式中一个字符串至少包含一个但不超过2个字母 "n"?

c# - 异步等待执行顺序 - 代码仅在单步调试/调试时才真正起作用

google-calendar-api - 生成 Google Hangouts session URL

.net - 在 C# 中转换日期

python - 使用icalendar解析日期并与python日期时间进行比较

c# - 使用单个值对象的不同表示

c# - 将 SalesForce 日历与 Google 日历同步

php - 如何使用 php 将事件插入用户谷歌日历?

c# - 使用 iCal.Net 发送 Microsoft Outlook session 邀请

c# - 什么是不一致的可访问性错误?