我正在开发一个可供盲人使用的前端应用程序。我成功创建,删除和更新events
。我的问题是,我希望获得定期event
的属性,即每天,每月等属性,以便我可以向用户显示重复event
的内容并进行更改。
我能想到的唯一方法是解析Recurrence
字符串。虽然,我发现它非常困难和耗时。任何人都可以想到我的问题的不同解决方案吗?
答案 0 :(得分:0)
如果我正确理解了这个问题,你想要显示如下内容:
Xyz every day at 5:00 pm starting on 6/1/2011 until 6/6/2011
但是,我认为这会迫使您根据在API中访问重复事件的方式向后工作。周期性事件的所有when
属性都存储在列表中(例如,上面每天的一个条目)。换句话说,解析这些字符串并确定关系似乎是实际确定关系的唯一明显方法。它
参考:http://code.google.com/apis/calendar/data/2.0/developers_guide_dotnet.html
编辑:实际上,似乎也可以访问重复字符串,尽管我无法在网上找到它。 CalendarEventEntry
中的gdata.calendar.data
类具有recurrence
类的属性gdata.data.Recurrence
。作为参考,这里是源文件中函数定义中提供的注释(我使用的是Python版本):
class Recurrence(atom.core.XmlElement):
"""The gd:recurrence element.
Represents the dates and times when a recurring event takes place.
The string that defines the recurrence consists of a set of properties,
each of which is defined in the iCalendar standard (RFC 2445).
Specifically, the string usually begins with a DTSTART property that
indicates the starting time of the first instance of the event, and
often a DTEND property or a DURATION property to indicate when the
first instance ends. Next come RRULE, RDATE, EXRULE, and/or EXDATE
properties, which collectively define a recurring event and its
exceptions (but see below). (See section 4.8.5 of RFC 2445 for more
information about these recurrence component properties.) Last comes a
VTIMEZONE component, providing detailed timezone rules for any timezone
ID mentioned in the preceding properties.
Google services like Google Calendar don't generally generate EXRULE
and EXDATE properties to represent exceptions to recurring events;
instead, they generate <gd:recurrenceException> elements. However,
Google services may include EXRULE and/or EXDATE properties anyway;
for example, users can import events and exceptions into Calendar, and
if those imported events contain EXRULE or EXDATE properties, then
Calendar will provide those properties when it sends a <gd:recurrence>
element.
Note the the use of <gd:recurrenceException> means that you can't be
sure just from examining a <gd:recurrence> element whether there are
any exceptions to the recurrence description. To ensure that you find
all exceptions, look for <gd:recurrenceException> elements in the feed,
and use their <gd:originalEvent> elements to match them up with
<gd:recurrence> elements.
"""
...
编辑2 : 相关问题,但没有答案 - Python solution to parse Google calendar's recurrencies。