通过XML向Google日历添加重复活动 [英] Adding recurring event to Google Calendar via XML
问题描述
我正在尝试通过Protocol API将重复事件添加到我的日历中.我从我在Google界面中创建的事件中提取了重复代码的语法,并将其用于我的创建请求中.这是我提交的内容:
I am trying to add a recurring event to my calendar via the Protocol API. I took the syntax of the recurrence tag from an event I created in Google's interface and used that in my create request. Here is what I submitted:
<?xml version='1.0' encoding='utf-8' ?>
<entry xmlns='http://www.w3.org/2005/Atom' xmlns:gd='http://schemas.google.com/g/2005'>
<category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/g/2005#event'></category>
<title type='text'>Hi Stack Overflow!</title>
<content type='text'>Help me please!</content>
<gd:where valueString='StackOverflow.com'></gd:where>
<gd:recurrence>
DTSTART;TZID=America/Los_Angeles:20090824T080000
DTEND;TZID=America/Los_Angeles:20090824T090000
RRULE:FREQ=DAILY;WKST=SU;UNTIL=20090828T090000
BEGIN:VTIMEZONE TZID:America/Los_Angeles X-LIC-LOCATION:America/Los_Angeles
BEGIN:DAYLIGHT TZOFFSETFROM:-0800 TZOFFSETTO:-0700 TZNAME:PDT DTSTART:19700308T020000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU
END:DAYLIGHT
BEGIN:STANDARD TZOFFSETFROM:-0700 TZOFFSETTO:-0800 TZNAME:PST DTSTART:19701101T020000
RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU
END:STANDARD
END:VTIMEZONE
</gd:recurrence>
</entry>
事件已添加,但不再重复.当我查看结果事件提要的重复出现部分时,没有定义重复的RRULE.
The event is added, but it does not repeat. When I look at the recurrence section of the resulting event feed, the RRULE that defines the repeating is not there.
谢谢您的帮助!
推荐答案
两件事:
-
您的时区部分无效-我相信每个属性都应单独放在一行上.
Your timezone section isn't valid - I believe each property should be on a line on its own.
您的"UNTIL"应该是UTC时间.从RFC2445:
Your "UNTIL" should be a UTC time. From RFC2445:
如果指定为日期时间值,则必须以UTC时间格式指定.
If specified as a date-time value, then it MUST be specified in an UTC time format.
因此,这是一个完整的示例,已将直到"部分的本地时间调整为UTC,并扩展了时区:
So here's a complete example, having adjusted the local time to UTC for the "until" part, and expanded the time zone:
DTSTART;TZID=America/Los_Angeles:20090824T080000
DTEND;TZID=America/Los_Angeles:20090824T090000
RRULE:FREQ=DAILY;WKST=SU;UNTIL=20090828T160000Z
BEGIN:VTIMEZONE
TZID:America/Los_Angeles
X-LIC-LOCATION:America/Los_Angeles
BEGIN:DAYLIGHT
TZOFFSETFROM:-0800
TZOFFSETTO:-0700
TZNAME:PDT
DTSTART:19700308T020000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:-0700
TZOFFSETTO:-0800
TZNAME:PST
DTSTART:19701101T020000
RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU
END:STANDARD
END:VTIMEZONE
我怀疑这可能是最近的变化.
I have a sneaking suspicion this may have been a recent change.
或者,您可能想要尝试完全省略VTIMEZONE部分-仅提供TZID,它应该是您知道Google日历支持的ID.例如:
Alternatively, you might want to try omitting the VTIMEZONE section entirely - just supply the TZID, which should be an ID that you know Google Calendar supports. For example:
DTSTART;TZID=America/Los_Angeles:20090824T080000
DTEND;TZID=America/Los_Angeles:20090824T090000
RRULE:FREQ=DAILY;WKST=SU;UNTIL=20090828T160000Z
这篇关于通过XML向Google日历添加重复活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!