3

我正在使用 Python,但我认为这与这里无关。下面的 iCal 片段来自 Outlook 2010 导出(完整数据)。在 Outlook 中,该事件显示为重复出现,包括 2012 年 4 月 12 日的事件实例。如果您打开该系列,它会显示

重复:每周四发生,从 2012 年 3 月 29 日起,从 12:00 PM 到 12:30 PM

我的问题是:是否可以从以下信息中得出重复计划?哪些字段会给我信息?我希望找到一个 RRULE,但这里没有这样的东西。

BEGIN:VEVENT
CLASS:PUBLIC
CREATED:20120312T133301Z
DESCRIPTION:\n
DTEND;TZID="Eastern Standard Time":20120329T123000
DTSTAMP:20120411T220938Z
DTSTART;TZID="Eastern Standard Time":20120329T120000
LAST-MODIFIED:20120531T155022Z
LOCATION:1501 Fake Street\, Conference Room G
PRIORITY:5
RECURRENCE-ID;TZID="Eastern Standard Time":20120419T120000
SEQUENCE:8
SUMMARY;LANGUAGE=en-us:My Cool Event
TRANSP:OPAQUE
UID:040000008200E00074C5B7101A82E008000000000029934B3300CD01000000000000000
    0100000001516438BA45C3946AF9C4C2A563FB2BE
X-ALT-DESC;FMTTYPE=text/html:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//E
    N">\n<HTML>\n<HEAD>\n<META NAME="Generator" CONTENT="MS Exchange Server ve
    rsion 14.02.5004.000">\n<TITLE></TITLE>\n</HEAD>\n<BODY>\n<!-- Converted f
    rom text/rtf format -->\n\n<P DIR=LTR><SPAN LANG="en-us"></SPAN><SPAN LANG
    ="en-us"></SPAN></P>\n\n</BODY>\n</HTML>
X-MICROSOFT-CDO-BUSYSTATUS:BUSY
X-MICROSOFT-CDO-IMPORTANCE:1
X-MICROSOFT-DISALLOW-COUNTER:FALSE
X-MS-OLK-APPTLASTSEQUENCE:16
X-MS-OLK-APPTSEQTIME:20120411T220937Z
X-MS-OLK-AUTOFILLLOCATION:FALSE
X-MS-OLK-CONFTYPE:0
END:VEVENT
4

2 回答 2

2

我使用以下程序浏览了您的 ICS 文件:

from icalendar import Calendar, Event
from datetime import datetime

cal = open('test.ics','rb')
ical = Calendar.from_ical(cal.read())
for component in ical.walk():
    if component.name == 'VEVENT':
        for item in component.sorted_items():

            if item[0] == 'RECURRENCE-ID':
                reoccur_item = item[1]
                print reoccur_item.params
                print reoccur_item.dt
                continue
            if item[0] == 'DTSTART':
                print 'DSTART', item[1].dt
                continue
            if item[0] == 'DTEND':
                print 'DTEND', item[1].dt
                continue
            if item[0] == 'DTSTAMP':
                print 'DTSTAMP', item[1].dt
                continue
            print item

cal.close()

以下是我获得的输出

('SUMMARY', vText(u'My Cool Event'))
DSTART 2012-03-29 12:00:00
DTEND 2012-03-29 12:30:00
DTSTAMP 2012-04-11 22:09:38+00:00
('UID', vText(u'040000008200E00074C5B7101A82E008000000000029934B3300CD01000000000000000   0100000001516438BA45C3946AF9C4C2A563FB2BE'))
RECURRENCE-ID Parameters({'TZID': 'Eastern Standard Time'})
RECURRENCE-ID 2012-04-19 12:00:00
('SEQUENCE', 8)
('CLASS', vText(u'PUBLIC'))
('CREATED', <icalendar.prop.vDDDTypes instance at 0x101c4e518>)
('DESCRIPTION', vText(u'\n'))
('LAST-MODIFIED', <icalendar.prop.vDDDTypes instance at 0x1020874d0>)
('LOCATION', vText(u'1501 Fake Street, Conference Room G'))
('PRIORITY', 5)
('TRANSP', vText(u'OPAQUE'))
('X-ALT-DESC', vText(u'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//E   N">\n<HTML>\n<HEAD>\n<META NAME="Generator" CONTENT="MS Exchange Server ve   rsion 14.02.5004.000">\n<TITLE></TITLE>\n</HEAD>\n<BODY>\n<!-- Converted f   rom text/rtf format -->\n\n<P DIR=LTR><SPAN LANG="en-us"></SPAN><SPAN LANG   ="en-us"></SPAN></P>\n\n</BODY>\n</HTML>'))
('X-MICROSOFT-CDO-BUSYSTATUS', vText(u'BUSY'))
('X-MICROSOFT-CDO-IMPORTANCE', vText(u'1'))
('X-MICROSOFT-DISALLOW-COUNTER', vText(u'FALSE'))
('X-MS-OLK-APPTLASTSEQUENCE', vText(u'16'))
('X-MS-OLK-APPTSEQTIME', vText(u'20120411T220937Z'))
('X-MS-OLK-AUTOFILLLOCATION', vText(u'FALSE'))
('X-MS-OLK-CONFTYPE', vText(u'0'))

重新发生规则是空的,这几乎看起来像是重新发生事件的单个实例,但最终是针对各种 Microsoft 特定数据。这有序列号 8 和 X-MS-OLK-APPTLASTSEQUENCE:16 表明最后一个实例应该有序列 16。

几乎看起来它已经在每个具有相同 UID 的团队上创建了多个带有序列标记的实例

于 2012-06-06T16:59:36.590 回答
0

您是否尝试使用 vba 导出日历?这可能是您获得规则的一个选择。您必须注意 Item.GetRecurrencePattern(Item 被声明为 myItem As AppointmentItem)并与 olRecursMonthly、olRecursYearly、...进行比较,然后查找项目的间隔和计数属性以重建整个 rrule 字符串。

您可以在此项目中找到更多详细信息:http: //sourceforge.net/projects/outlook2ical/files/outlook2ical/v1.04/

于 2012-06-15T06:39:45.743 回答