如何为重复事件编写 ICS 文件? [英] How can an ICS file be written for a recurring event?

查看:17
本文介绍了如何为重复事件编写 ICS 文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个 ICS 文件来描述重复事件,该事件在 2016 年全年世界标准时间每周一的 13:00 到 14:00 发生.ICS 文件应该可以通过 Google 日历导入.我发现很难在网上找到和理解有关如何构建这样一个文件的详细信息.我目前拥有的是一种创建包含单个事件列表的文件的方法,但我希望为文件中定义的事件制定规则.我现在有类似以下内容:

I want to create an ICS file that describes a recurring event, an event that takes place every Monday from 13:00 to 14:00 UTC for all of 2016. The ICS file should be importable by Google Calendar. I have found it difficult to find and understand details online about how such a file could be constructed. What I have currently is a way of creating a file that contains a list of individual events, but I want to have a rule for the events defined in the file instead. I have something like the following right now:

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//SERN//INDICO//EN
BEGIN:VEVENT
SUMMARY:Software Meeting
DTSTART;VALUE=DATE-TIME:20160818T150000Z
DTEND;VALUE=DATE-TIME:20160818T160000Z
DTSTAMP;VALUE=DATE-TIME:20160912T165700Z
UID:indico-event-563636@sern.ch
DESCRIPTION:https://indico.sern.ch/event/999999/
LOCATION:42-3-002 (SERN)
URL:https://indico.sern.ch/event/999999/
END:VEVENT
BEGIN:VEVENT
SUMMARY:Software Meeting
DTSTART;VALUE=DATE-TIME:20160825T150000Z
DTEND;VALUE=DATE-TIME:20160825T160000Z
DTSTAMP;VALUE=DATE-TIME:20160912T165700Z
UID:indico-event-565483@sern.ch
DESCRIPTION:https://indico.sern.ch/event/999999/
LOCATION:42-3-002 (SERN)
URL:https://indico.sern.ch/event/999999/
END:VEVENT
END:VCALENDAR

<小时>

遵循解决方案/zcontent">zcontent,我编写了以下似乎可以成功运行的 ICS 文件:


Following the solution provided by zcontent, I wrote the following ICS file that appears to work successfully:

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//SERN//INDICO//EN
BEGIN:VEVENT
SUMMARY:Software Meeting
TZID:Europe/Zurich
DTSTART:20150202T170000
DTEND:20150202T180000
DTSTAMP:20150202T170000
RRULE:FREQ=WEEKLY;UNTIL=20380119T000000
UID:indico-event-565483@sern.ch
DESCRIPTION:https://indico.sern.ch/event/999999/
LOCATION:42-3-002 (SERN)
URL:https://indico.sern.ch/event/999999/
END:VEVENT
END:VCALENDAR

推荐答案

您需要为事件添加一个 RRULE 属性.对于 2016 年重复的星期一活动,您需要在活动中包含这样的行:

You will need to add an RRULE property to the event. For a repeating Monday event for 2016, you will need to have lines like this in your event:

DTSTART:20160104T130000Z

DTSTART:20160104T130000Z

DTEND:20160104T140000Z

DTEND:20160104T140000Z

RRULE:FREQ=WEEKLY;UNTIL=20170101T000000Z

RRULE:FREQ=WEEKLY;UNTIL=20170101T000000Z

您可以在此处找到有关 RRULE 语法的详细信息:http://icalendar.org/iCalendar-RFC-5545/3-8-5-3-recurrence-rule.html

You can find the details about the RRULE syntax here: http://icalendar.org/iCalendar-RFC-5545/3-8-5-3-recurrence-rule.html

您可能还会发现在测试期间验证您的 icalendar 提要很有用,以确保 Google 日历不会出现问题.这是一个有用的验证工具:http://icalendar.org/validator.html

You may also find it useful to validate your icalendar feed during testing to ensure Google Calendar won't have an issue with it. Here is a useful validation tool: http://icalendar.org/validator.html

免责声明:我认为 icalendar 验证器工具是互联网上最好的,但我也写了它:-)

Disclaimer: I think the icalendar validator tool is the best on the internet, but I also wrote it :-)

这篇关于如何为重复事件编写 ICS 文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆