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
recurrence: Occurs every Thursday effective 3/29/2012 from 12:00 PM to 12:30 PM
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
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()
And following is the output that I obtained
('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'))
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.
It almost looks like it has created multiple instances with sequence stamp on each of team with the same UID
did you try exporting the calendar using vba? this might be an option for you to get the rrule. you would have to watch for Item.GetRecurrencePattern (Item being declared as myItem As AppointmentItem) and compare to olRecursMonthly, olRecursYearly, ... then look for the interval and count attributes of your item to rebuild the whole rrule string.
you can find more details at this project: http://sourceforge.net/projects/outlook2ical/files/outlook2ical/v1.04/
来源:https://stackoverflow.com/questions/10917232/parsing-ical-from-outlook-how-do-i-tell-what-the-recurrence-schedule-is-for-thi