outlook calendar event from form post [closed]

After someone fills out a form on my site (using gravity forms) is there any known integration/widget that would allow me to have an “Add this event to my Outlook Calendar” link in the submission email/text?

Thanks

1 Answer
1

I am not aware of any special plugin to do that , there are many that have this functionality , but only when using as a whole event system (and not specific to gravity forms as far as i know).
But – fortunately , it is fairly easy to make with PHP :
you just have to construct a simple string.

header("Content-Type: text/Calendar");
header("Content-Disposition: inline; filename=event.ics");
$ics_string = 'BEGIN:VCALENDAR\n';
$ics_string .= 'VERSION:2.0\n';
$ics_string .= 'PRODID:-//whatever//NONSGML //EN\n';
$ics_string .= 'METHOD:REQUEST\n'; // requied only 4  Outlook
$ics_string .= 'BEGIN:VEVENT\n';
$ics_string .= 'UID:'.date('Ymd').'T'.date('His').'-'.md5(uniqid(mt_rand(), true)).'-mystrinng'; // requied only 4  Outlook - you can use only simple rand(0,999999)
$ics_string .= 'DTSTAMP:".date('Ymd').'T'.date('His')."\n'; //requied only 4  Outlook
$ics_string .= 'DTSTART:20120416T000000\n'; // april 16 2012, T = HHMMSS
$ics_string .= 'SUMMARY:your summery\n';
$ics_string .= 'DESCRIPTION: your description\n';
$ics_string .= 'END:VEVENT\n';
$ics_string .= 'END:VCALENDAR\n';
echo $ics_string;

of course , you will populate the fields with whatever you want , for example :

$summery = get_the_title();
$desc = get_the_excerpt();

and in the string :

 $ics_string .= 'SUMMARY:' . $summery . '\n';

or

 $ics_string .= 'DESCRIPTION:' . $desc . '\n';

you can even use GET or POST

echo 'DTSTART:$_GET[date]\n';
echo 'SUMMARY:Go to a movie with ' . $_GET[girlfriend] . '\n';
echo 'DESCRIPTION: be careful not to be caught by ' . $_GET[other_girlfriend] . ' or ' .$_GET[wife] .'\n';

see specs for format here : http://www.kanzaki.com/docs/ical/

here http://www.ietf.org/rfc/rfc2445.txt

or here http://en.wikipedia.org/wiki/ICalendar

Leave a Comment