Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calendar app on the Mac does not accept this ics. #390

Closed
csmeets opened this issue Mar 2, 2022 · 6 comments · Fixed by #479
Closed

Calendar app on the Mac does not accept this ics. #390

csmeets opened this issue Mar 2, 2022 · 6 comments · Fixed by #479

Comments

@csmeets
Copy link

csmeets commented Mar 2, 2022

When i try to import a downloaded .ics file with this content, no calendar item is imported in the calendar

BEGIN:VCALENDAR
PRODID:platform
VERSION:2.0
CALSCALE:GREGORIAN
BEGIN:VEVENT
UID:94b10624-55ac-4974-b87d-48408e89a841
DTSTAMP:20220302T084901Z
SUMMARY:testx
DESCRIPTION:Join: https://test.nl
DTSTART;UTC=:20220303T083800
DTEND;TZID=UTC:20220303T093800
ORGANIZER:mailto:test%40test.io
SEQUENCE:0
DURATION:P0DT1H0M0S
END:VEVENT
END:VCALENDAR

Are there any suggestions?

@markuspoerschke
Copy link
Owner

Can you show us the minimal working PHP code that is needed to create this ICS output? Which version of this library do you use?

@csmeets
Copy link
Author

csmeets commented Mar 2, 2022

HI Thank you very much for your quick response..

We use version 2.5.0

This is the code we use to generate the .ics

/** @param array<Shortcode> $shortcodes */
public function generatePersonal(
    Meeting $meeting,
    User $recipient,
    string $type,
    array $shortcodes
): string {
    $attendee = new Attendee(new EmailAddress($recipient->getEmailaddress()));

    $vEvent = $this->createEvent($meeting);
    $vEvent
        ->addAttendee($attendee)
        ->setDescription($this->getEmailBody($recipient, $shortcodes, $type))
    ;

    if ($meeting->isCancelled()) {
        $vEvent->setMethod('CANCEL');
        $vEvent->setStatus('CANCELLED');
    }

    $vCalendar = new Calendar([$vEvent]);
    $vCalendar->setProductIdentifier('test-platform');

    $vCalendarComponent = (new CalendarFactory(new MeetingEventFactory()))->createCalendar($vCalendar);

    return (string) $vCalendarComponent;
}

private function createEvent(Meeting $meeting): MeetingEvent
{
    $vEvent = new MeetingEvent(new UniqueIdentifier($meeting->getMeetingId()->toString()));

    $vEvent
        ->setSequence($meeting->getVersion())
        ->setDuration($meeting->getEstimatedDuration())
        ->setSummary($meeting->getTitle())
        ->setOccurrence(new TimeSpan(
            new DateTime($meeting->getScheduledAt(), true),
            new DateTime($meeting->getEstimatedEndTime(), true)
        ))
        ->touch(new Timestamp(new DateTimeImmutable()))
        ->setOrganizer($this->getOrganizer())
    ;

    return $vEvent;
}

If you need more info please let me know.

Thanks very much in advance

@florianmuellerCH
Copy link

florianmuellerCH commented Mar 13, 2022

I'm having the same issue - generating a very simple ICS file does not work in mobile safari on my iPhone 8. Instead it prompts me to "download cal.ics.html". I'm using a very standard event with little information, see following ical file:

BEGIN:VCALENDAR
PRODID:-//eluceo/ical//2.0/EN
VERSION:2.0
CALSCALE:GREGORIAN
BEGIN:VEVENT
UID:e48b646f1d49a5102a8e72d8ad711b63
DTSTAMP:20220313T225532Z
SUMMARY:My Event Title
DESCRIPTION:https://www.mydomain.com/some/link
DTSTART:20221021T180000
DTEND:20221021T210000
ORGANIZER;CN=My Organizer Name:mailto:info%40mydomain.com
END:VEVENT
END:VCALENDAR

When generating, I'm writing these headers:

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

@florianmuellerCH
Copy link

Update: I tested this on various platforms including Mac, and it works fine on Mac OSX, but simply not at all mobile on iOS 15.3.1.

@JorisDebonnet
Copy link

This may be caused by #434, which has a fix in #444.

markuspoerschke added a commit that referenced this issue Dec 23, 2022
Do not url encode email addresses.

Fixes #444
Fixes #434
Fixes #390
@markuspoerschke
Copy link
Owner

Thanks for raising this issue.

This bug will be fixed in #479.

markuspoerschke added a commit that referenced this issue Dec 23, 2022
Do not url encode email addresses.

Fixes #444
Fixes #434
Fixes #390
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants