Microsoft Outlook 2016 doesn't display HTML formatting in ICS Appointment description. Bold and Header tags work in Outlook 2013 but tables don't.
I use a PHP code that creates an ics file as an attachment with the necessary parameters and html tags in X-ALT-DESC;FMTTYPE=text/html. Also have tried to reverse engineer by creating the appointment in outlook 2013 and exporting as an ics file.
public function download(Request $request)
{
$id = $request->id;
$appointment = Appointment::find($id);//get appointment by id
$start_obj = DateTime::createFromFormat('Y-m-d H:i:s', $appointment->start_time);
$end_obj = DateTime::createFromFormat('Y-m-d H:i:s', $appointment->end_time);
$start = $start_obj->format('Ymd') . 'T' . $start_obj->format('His');
$end = $end_obj->format('Ymd') . 'T' . $end_obj->format('His');
$name = $appointment->reference_code;
$location = $appointment->property->name;
$description = 'Reference Code: ' . $appointment->reference_code . "\
";
$description .= 'Client: ' . $appointment->client->name . "\
";
$description .= 'Date & Time of appointment: ' . $appointment->start_time . "\
";
$html_description = '
<html>
<body>
<table border="1" style="border-collapse: collapse;">
<tr>
<td><b>Reference Code:</b> </td><td style="padding:1em"> ' . $appointment->reference_code . '</td>
</tr>
<tr>
<td><b>Client:</b> </td><td style="padding:1em"> ' . $appointment->client. '</td>
</tr>
<tr>
<td><b>Date & Time of appointment:</b> </td><td style="padding:1em"> ' . $appointment->start_time . '</td>
</tr>
</table>
</body>
</html>
';
//set file header properties. allow for file download
header("Content-Type: text/Calendar; charset=utf-8");
header("Content-Disposition: attachment; filename={$name}.ics");
//set file content
$ics_content = '';
$ics_content .= "BEGIN:VCALENDAR
";
$ics_content .= "VERSION:2.0
";
$ics_content .= "PRODID:-//Example/Scheduler//NONSGML {$name}//EN
";
$ics_content .= "METHOD:PUBLISH
";
$ics_content .= "X-MS-OLK-FORCEINSPECTOROPEN:TRUE
";
$ics_content .= "BEGIN:VEVENT
";
$ics_content .= "CLASS:PUBLIC
";
$ics_content .= "UID:info@example.com
";
$ics_content .= "DTSTAMP:{$start}
";
$ics_content .= "ORGANIZER;CN=info@example.com
";
$ics_content .= "DTSTART:{$start}
";
$ics_content .= "DTEND:{$end}
";
$ics_content .= "LOCATION:{$location}
";
$ics_content .= "SUMMARY:{$appointment_type} - Appointment Summary {$name}
";
$ics_content .= "DESCRIPTION:{$description}
";
$ics_content .= "X-ALT-DESC;FMTTYPE=text/html:{$html_description}
";
$ics_content .= "X-MICROSOFT-CDO-BUSYSTATUS:BUSY
";
$ics_content .= "X-MICROSOFT-CDO-IMPORTANCE:1
";
$ics_content .= "X-MICROSOFT-DISALLOW-COUNTER:FALSE
";
$ics_content .= "X-MS-OLK-CONFTYPE:0
";
$ics_content .= "BEGIN:VALARM
";
$ics_content .= "TRIGGER:-PT1440M
";
$ics_content .= "REPEAT:1
";
$ics_content .= "DURATION:PT15M
";
$ics_content .= "ACTION:DISPLAY
";
$ics_content .= "DESCRIPTION:{$appointment_type} - Appointment Description - {$name}
";
$ics_content .= "END:VALARM
";
$ics_content .= "END:VEVENT
";
$ics_content .= "END:VCALENDAR
";
return $ics_content;
}
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Example/Scheduler//NONSGML test 002//EN
METHOD:PUBLISH
X-MS-OLK-FORCEINSPECTOROPEN:TRUE
BEGIN:VEVENT
CLASS:PUBLIC
UID:info@example.com
DTSTAMP:20190507T130000
ORGANIZER;CN=info@example.com
DTSTART:20190507T130000
DTEND:20190509T150000
LOCATION:23 sdq13
SUMMARY:Inventory & Check Out - Appointment - test002
DESCRIPTION:Reference Code: test furnished002
Client: Romaguera, Kertzmann and Green
Date & Time of appointment: 2019-05-07 13:00:00
X-ALT-DESC;FMTTYPE=text/html:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//E
N">
<HTML>
<HEAD>
<META NAME="Generator" CONTENT="MS Exchange Server ve
rsion rmj.rmm.rup.rpr">
<TITLE></TITLE>
</HEAD>
<body>
<table border="1" style="border-collapse: collapse;">
<tr>
<td><b>Reference Code:</b> </td><td style="padding:1em"> test 002</td>
</tr>
<tr>
<td><b>Client:</b> </td><td style="padding:1em"> Romaguera, Kertzmann and Green</td>
</tr>
<tr>
<td><b>Date & Time of appointment:</b> </td><td style="padding:1em"> 2019-05-07 13:00:00</td>
</tr>
</table>
</body>
</HTML>
X-MICROSOFT-CDO-BUSYSTATUS:BUSY
X-MICROSOFT-CDO-IMPORTANCE:1
X-MICROSOFT-DISALLOW-COUNTER:FALSE
X-MS-OLK-CONFTYPE:0
BEGIN:VALARM
TRIGGER:-PT1440M
REPEAT:1
DURATION:PT15M
ACTION:DISPLAY
DESCRIPTION:Inventory & Check Out - Appointment - test002
END:VALARM
END:VEVENT
END:VCALENDAR
Expected result should be HTML formatted (with tables) event description for MS Outlook (2016 is priority).
Any help will be very much appreciated.