从Outlook解析iCal:如何知道此事件的重复计划? [英] Parsing iCal from Outlook: how do I tell what the recurrence schedule is for this event?

查看:120
本文介绍了从Outlook解析iCal:如何知道此事件的重复计划?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm using Python, but I don't think that's relevant here. The iCal snippet below is from an Outlook 2010 export (full data). In Outlook, the event shows up as recurring, including an instance of the event on April 12th, 2012. If you open the series, it says

重复发生:从2012年3月29日开始的每个星期四,从12:00 PM到12:30 PM发生

recurrence: Occurs every Thursday effective 3/29/2012 from 12:00 PM to 12:30 PM

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

My question is: is it possible to derive the recurrence schedule from the information below? Which fields will give me the information? I would expect to find an RRULE, but there's no such thing here.

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

推荐答案

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

I ran through your ICS file with following program:

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.

The re-occurrence rule is empty and this almost looks like single instance of the re-occuring event but for the various Microsoft specific data in the end. This has sequence number 8 and X-MS-OLK-APPTLASTSEQUENCE:16 suggests that the last instance should have sequence 16.

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

It almost looks like it has created multiple instances with sequence stamp on each of team with the same UID

这篇关于从Outlook解析iCal:如何知道此事件的重复计划?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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