简体   繁体   中英

Outlook not importing multiple events in an ics file

I have an issue with a generated iCal file.

It appears to be generating the code correctly and the .ics file is loaded with multiple events, however when I open the file in outlook it only imports the first event into my calendar and the rest are not added.

Here is the Generated iCal File

BEGIN:VCALENDAR
PRODID:-//Microsoft Corporation//Outlook 12.0 MIMEDIR//EN
VERSION:2.0
METHOD:PUBLISH
X-WR-CALNAME: Calendar
CALSCALE:GREGORIAN
X-MS-OLK-FORCEINSPECTOROPEN:TRUE
BEGIN:VTIMEZONE
TZID:Europe/London
BEGIN:DAYLIGHT
TZOFFSETFROM:+0000
TZOFFSETTO:+0100
DTSTART:19810329T010000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
TZNAME:BST
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:+0100
TZOFFSETTO:+0000
DTSTART:19961027T020000
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
TZNAME:GMT
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
DTSTART:20140906T090000
DTEND:20140906T170000
UID:224
DTSTAMP:20140721T102908
LOCATION:
DESCRIPTION:Explore the College with current students\, chat with the Director of Studies in your subject\, meet our admissions tutors\,
URL;VALUE=URI:http://www.domain.com/events-224
SUMMARY:Open Day (undergraduate)
END:VEVENT
BEGIN:VEVENT
DTSTART:20141208T000000
DTEND:20141212T000000
UID:416
DTSTAMP:20140721T102908
LOCATION:
DESCRIPTION:Admissions Interviews
URL;VALUE=URI:http://www.domain.com/events-416
SUMMARY:Admissions Interviews
END:VEVENT
BEGIN:VEVENT
DTSTART:20141215T000000
DTEND:20141218T000000
UID:417
DTSTAMP:20140721T102908
LOCATION:
DESCRIPTION:Admissions Interviews
URL;VALUE=URI:http://www.domain.com/events-417
SUMMARY:Admissions Interviews
END:VEVENT
BEGIN:VEVENT
DTSTART:20150112T000000
DTEND:20150116T000000
UID:419
DTSTAMP:20140721T102908
LOCATION:
DESCRIPTION:Admissions Interviews
URL;VALUE=URI:http://www.domain.com/events-419
SUMMARY:Admissions Interviews
END:VEVENT
BEGIN:VEVENT
DTSTART:20150314T000000
DTEND:20150314T000000
UID:67
DTSTAMP:20140721T102908
LOCATION:
DESCRIPTION:Explore the College with current students\, chat with the Director of Studies in your subject and meet our admissions tutors. 

URL;VALUE=URI:http://www.domain.com/events-67
SUMMARY:Admissions Open Day (Arts)
END:VEVENT
BEGIN:VEVENT
DTSTART:20150425T000000
DTEND:20150425T000000
UID:73
DTSTAMP:20140721T102908
LOCATION:
DESCRIPTION:Explore the College with current students\, chat with the Director of Studies in your subject and meet our admissions tutors.
URL;VALUE=URI:http://www.domain.com/events-73
SUMMARY:Admissions Open Day (Sciences)
END:VEVENT
END:VCALENDAR

The following is the variables for setting the header and footer of the iCal file

$iCalHeader = "" .
        "BEGIN:VCALENDAR\n" .
        "PRODID:-//Microsoft Corporation//Outlook 12.0 MIMEDIR//EN\n" .
        "VERSION:2.0\n" .
        "METHOD:PUBLISH\n";

    $iCalHeaderBottom = "CALSCALE:GREGORIAN\n" .
        "X-MS-OLK-FORCEINSPECTOROPEN:TRUE\n" .
        "BEGIN:VTIMEZONE\n" .
        "TZID:Europe/London\n" .
        "BEGIN:DAYLIGHT\n" .
        "TZOFFSETFROM:+0000\n" .
        "TZOFFSETTO:+0100\n" .
        "DTSTART:19810329T010000\n" .
        "RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU\n" .
        "TZNAME:BST\n" .
        "END:DAYLIGHT\n" .
        "BEGIN:STANDARD\n" .
        "TZOFFSETFROM:+0100\n" .
        "TZOFFSETTO:+0000\n" .
        "DTSTART:19961027T020000\n" .
        "RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU\n" .
        "TZNAME:GMT\n" .
        "END:STANDARD\n" .
        "END:VTIMEZONE\n";

    $iCalFooter = "END:VCALENDAR";

And finally the code that generates the event

$iCal .= "BEGIN:VEVENT\n".
                "DTSTART:" . date('Ymd\THis', strtotime($row2["EVENT_StartDateTime"])) ."\n".
                "DTEND:" . date('Ymd\THis', strtotime($row2["EVENT_EndDateTime"])) . "\n".
                "UID:" . $row2["EVENT_ID"] . "\n".
                "DTSTAMP:" . date('Ymd\THis', time()) . "\n".
                "LOCATION:$address\n".
                "DESCRIPTION:" . $this->escapeString($description) . "\n".
                "URL;VALUE=URI:http://www.domain.com/events-" . $row2["EVENT_ID"] . "\n".
                "SUMMARY:" . $this->escapeString($title) . "\n".
                "END:VEVENT\n";

It works for the first event so I don't think it's a problem with the code that's generated for each event, I have done a little researching but I can't seem to find a solution, is there an extra statement that needs to be used between each event?

Or perhaps outlook does not support multiple events in a single iCal and therefore only imports the first one?

any help or suggestions would be greatly appreciated.

Thanks in advance.

Your Icalendar passes this validator , but try adding an ORGANIZER for each event. This field is mandatory by my reading of the spec .

This could be a problem of expectations. When you say "importing", how are you sending/opening the calendar and what do you expect to happen? In general, outlook and other clients have two treatments for Icalendars. If the Icalendar contains one event, has METHOD=REQUEST, and is lucky , it will be displayed as an invitation, with a button to directly add it to the user's calendar. (If it is very lucky, and the recipient's email is in the attendee field, the event may display in the calendar greyed out before it has been previewed or opened in a mail view. Otherwise is will appear after it has been previewed.)

If it has more than one event, or any number of other little problems, it will be displayed as an attachment (if received by mail) and the user will have to grub around to open it. Multi event calendars, received by mail or opened from an URL, are treated as a separate calendars. There is no proposition to add their events to the user's calendar, but the user can select and drag the events if they know what they're doing.

Probably way to late to answer this question, but might help others.

https://docs.microsoft.com/en-us/openspecs/exchange_server_protocols/ms-oxcical/d2a0a079-02a6-4643-9e78-0ac35998e1fb

X-MS-OLK-FORCEINSPECTOROPEN

If this property is set to TRUE, the iCalendar stream SHOULD<18> be imported as a single Calendar object, regardless of the number of VEVENT components present in the iCalendar. Note that it is possible for an iCalendar file containing multiple VEVENT components to represent a single appointment through the use of the RECURRENCE-ID property specified in section

This happens if you open the calendar. If you import it, then it works fine: 在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM