Outlook-web-app不会从我生成的icalendar中导入事件

For my application I use laravel 5.3 and a package called markuspoerschke/iCal which you can find here.

When a student wants to subscribe to his or her calender, we generate an URL which can be filled into Google Calender and Outlook. Except the last mentioned outlook it isn't importing any events.

Example of how our generated ICS looks like. This contains 1 event with the description of 'test'.

BEGIN:VCALENDAR 
VERSION:2.0 
PRODID:www.onderwijsonline.nl 
X-PUBLISHED-TTL:PT15M 
BEGIN:VEVENT 
UID:58e5f21fc2551 
DTSTART;TZID=Europe/Amsterdam:20170406T090000 
SEQUENCE:0 
TRANSP:OPAQUE DTEND;TZID=Europe/Amsterdam:20170406T140000 URL:http://oo.dev/calendar/event/420 
SUMMARY:Test 
CLASS:PUBLIC 
DTSTAMP:20170406T094535Z 
END:VEVENT 
END:VCALENDAR

The script that calls the package to generate this:

public function getIcal($token = null)
    {
        $user = $this->userRepository->getByToken($token);

        $vCalendar = new \Eluceo\iCal\Component\Calendar('www.onderwijsonline.nl');
        $vCalendar->setPublishedTTL('PT15M');

        if (!is_null($user)) {

            /**
             * Calendar events
             */
            $events = $this->calendarRepository->getEventsForUser($user->id, Carbon::now()->subWeeks(2), Carbon::now()->addWeeks(6));
            foreach ($events as $event) {

                $vEvent = new \Eluceo\iCal\Component\Event();

                $vEvent
                    ->setUseTimezone(true)
                    ->setUseUtc(false)
                    ->setDtStart(Carbon::parse($event['start']))
                    ->setDtEnd(Carbon::parse($event['end']))
                    ->setNoTime(($event['allDay'] == 1 ? true : false))
                    ->setUrl($event['href'])
                    ->setDescription($event['description'])
                    ->setSummary($event['title']);

                $vCalendar->addComponent($vEvent);
            }

            /**
             * Project events
             */
            $events = $this->calendarRepository->getEventsForProjects($user->id, null, null);

            foreach ($events as $event) {
                $vEvent = new \Eluceo\iCal\Component\Event();

                $vEvent
                    ->setUseTimezone(true)
                    ->setUseUtc(false)
                    ->setDtStart(Carbon::parse($event['start']))
                    ->setDtEnd(Carbon::parse($event['end']))
                    ->setNoTime(($event['allDay'] == 1 ? true : false))
                    ->setUrl($event['href'])
                    ->setSummary($event['title']);

                $vCalendar->addComponent($vEvent);
            }

            /**
             * Timetable events
             */
            $events = $this->calendarRepository->getEventsForTimetables($user->id, Carbon::now()->subWeeks(2), Carbon::now()->addWeeks(6));
            foreach ($events as $event) {
                $vEvent = new \Eluceo\iCal\Component\Event();

                $vEvent
                    ->setUseTimezone(true)
                    ->setUseUtc(false)
                    ->setDtStart(Carbon::parse($event['start']))
                    ->setDtEnd(Carbon::parse($event['end']))
                    ->setNoTime(($event['allDay'] == 1 ? true : false))
                    ->setSummary($event['title']);

                $vCalendar->addComponent($vEvent);
            }
        }

        header('Content-Type: text/calendar; charset=utf-8');
        header('Content-Disposition: inline; filename=onderwijsonline.ics');

        return $vCalendar->render();
    }

As I've mentioned above, this exact setup works fine for Google Calendar, but is not for outlook.

Does anyone know why and how that can be fixed?

1个回答



您使用的是TZID = Europe / Amsterdam,但您的ics文件不包含与此TZID对应的VTIMEZONE定义。 所以在你的BEGIN:VEVENT之前,你应该有一个BEGIN:VTIMEZONE ... END:VTIMEZONE组件。</ p>

至于为什么它仍适用于谷歌而不适用于Outlook:很多 产品确实使用Olson TZID,因此他们可以忽略VTIMEZONE定义缺失的事实,并假设您的TZID = Europe / Amsterdam对应于它们的映射。</ p>

另一方面,Microsoft已经 它自己的一组TZID标识符(例如“中欧标准时间”),因此无法将您的欧洲/阿姆斯特丹映射到已知的定义。</ p>

最后,堆栈溢出至少您的TRANSP, DTEND和URL属性确实出现在同一行上。 我假设这只是提交问题时的格式问题(???)。</ p>
</ div>

展开原文

原文

You are using a TZID=Europe/Amsterdam but your ics file does not include the VTIMEZONE definition corresponding to this TZID. So before your BEGIN:VEVENT, you should have a BEGIN:VTIMEZONE...END:VTIMEZONE component.

As far as why it still works for Google but not for Outlook: A lot of products do use the Olson TZIDs so they can ignore the fact that the VTIMEZONE definition is missing and just assume that your TZID=Europe/Amsterdam corresponds to their mapping.

Microsoft on the other hand has its own set of TZID identifiers (e.g. "Central Europe Standard Time") and hence can not map your Europe/Amsterdam to a known definition.

Finally, on stack overflow at least your TRANSP, DTEND and URL property do appear on the same line. I'm assuming that this is just a formatting issue when submitting your question (???).

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐