Man, the weather's getting nice out there... Makes me not want to program. Yet, here I am.
Today I had the task of somehow getting a PHP-generated web app to generate an Outlook appointment based on database information, and have it work.
Turns out that 2 hours later, I have it functioning perfectly, thanks, in large part to this blog
entry. (Thanks Luke!)
So, in case you didn't want to read his entry, I'll post basically the same code snippet here as he did there, without the detailed explanation.
//SET THE TIMEZONE
$success = date_default_timezone_set("America/Denver");
header("Content-Disposition: inline; filename=calendar.ics");
echo "PRODID:-//Generated by PHP in Linux!//NONSGML Linux Rocks//EN\n";
echo "METHOD:REQUEST\n"; // requied by Outlook
echo "UID:".date('Ymd').'T'.date('His')."-".rand()."-example.com\n"; // required by Outlok
echo "DTSTAMP:".date('Ymd').'T'.date('His')."\n"; // required by Outlook
echo "SUMMARY:Visit with $_GET[contact]\n";
echo "DESCRIPTION: Visit with $_GET[contact] at $_GET[customer]\n";
You'll, of course, want to get rid of the GET variable crud, but other than that, I have verified that this works with Outlook 2003. In outlook 2007, it comes as an event, but not an appointment. I'll have to figure that out later.
So... Happy code pirating. (worked for me!)