View Full Version : Calendar: Add event to Outlook Calendar?
mkdevo
03-17-2005, 10:59 AM
i saw this here (http://www.jambase.com/search.asp?eventID=283585) and was wondering if something similar could be done in VB for adding a VB calendar event to your MS Outlook calendar.. it would be extremely useful..
anyone have any idea of how easy/difficult this would be?
Colin F
03-17-2005, 11:42 AM
Your example is coded in ASP, but it's an interesting idea.
I think I'll have a look at that...
It seems they're using a vcs file.
Here is the format:
BEGIN:VCALENDAR
VERSION:1.0
BEGIN: VEVENT
DTStart:20050317T000000
DTEnd:20050318T000000
Location;ENCODING=QUOTED-PRINTABLE:River Street Jazz Cafe | Plains, PA
UID:20050317T00000020050318T000000
DESCRIPTION;ENCODING=QUOTED-PRINTABLE:=0D=0A=0D=0ANote: Start and endtimes of Outlook appointment above may differ from official event starttime=0D=0A=0D=0AMore Info:http://www.jambase.com/search.asp?eventID=3D283585=0D=0A=0D=0AGo SeeLive Music!=0Dhttp://www.jambase.com
SUMMARY;ENCODING=QUOTED-PRINTABLE:The Breakfast
PRIORITY:3
End:VEVENT
End:VCALENDAR
What would need to be done is code a page which outputs this data, given the eventid. Not that hard actually...
Colin F
03-17-2005, 12:25 PM
Here's some code you can use:
if ($_REQUEST['do'] == 'outlookevent')
{
if (!$eventinfo['eventid'])
{
eval(print_standard_error('error_invalidid'));
}
$noheader = 1;
$fromdate_1 = date('Ymd', $eventinfo['dateline_from']);
$fromdate_2 = date('His', $eventinfo['dateline_from']);
$fromdate = $fromdate_1 . 'T' . $fromdate_2;
if ($eventinfo['dateline_to'] != 0)
{
$todate_1 = date('Ymd', $eventinfo['dateline_to']);
$todate_2 = date('His', $eventinfo['dateline_to']);
}
else
{
$todate_1 = date('Ymd', $eventinfo['dateline_to'] + 86400);
$todate_2 = date('His', $eventinfo['dateline_to']);
}
$todate = $todate_1 . 'T' . $todate_2;
$vcsoutput = 'BEGIN:VCALENDAR
VERSION:1.0
BEGIN: VEVENT
DTStart:' . $fromdate . '
DTEnd:' . $todate_1 . '
UID:' . $fromdate . $todate_1 . '
DESCRIPTION;ENCODING=QUOTED-PRINTABLE:=0D=0A=0D=0A' . $eventinfo[event] . '
PRIORITY:3
End:VEVENT
End:VCALENDAR';
header('Content-type: application/download');
header('Content-Disposition: attachment; filename=event.vcs');
echo $vcsoutput;
exit;
}
Add this to your calendar.php, before this:
eval(print_standard_error('error_invalidid'));
/*================================================= =====================*\
|| ################################################## ##################
Then, add a link and link to calendar.php?do=outlookevent&e=$eventid
mkdevo
03-17-2005, 02:41 PM
colin -
wow. thanks. i have a couple of issues though.
first is probably something simple - when i added the link to my template, i altered the following in calendar_showeventsbit:
<tr>
<td width="50%" class="tcat">$eventinfo[title]</td>
<td width="50%" class="tcat"><p align="right"><a href="http://www.thebreakfast.info/forum/calendar.php?do=outlookevent&e=$eventid">Add to Outlook <img border="0" src="http://www.thebreakfast.info/images/outlook_logo.gif" width="30" height="30"></a></td>
</tr>
that messed up my main cell (see pic below).. can you tell what i did wrong there?
now, when i click on the link, i get:
Invalid Event specified. If you followed a valid link, please notify the webmaster
i'm guessing i messed something up with the link (see code above), because when i hover over it, it shows ...calendar.php?do=outlookevent&e=0
just wondering if you could help me get this going. thanks again!
dave
Colin F
03-17-2005, 07:49 PM
use $eventinfo[eventid] instead of $eventid
Also, you might have to change the colspan for the table cells below...
zylstra
05-25-2005, 04:26 PM
Don't forget to addSUMMARY: ' . $eventinfo[title] . 'before the DESCRIPTION: part.
Also, the dates aren't correct for ranged events. I'll have to fix this later.
zennifer
10-10-2006, 05:04 PM
Is anyone working on this? I have it almost working but the timezones are causing an issue with the times not being correct.
Here's what I have:
// ############################## add to outlook ############################
if ($_REQUEST['do'] == 'outlookevent')
{
if (!$eventinfo['eventid'])
{
eval(standard_error(fetch_error('invalidid')));
}
$noheader = 1;
if (date('Ymd', $eventinfo['dateline_to']) >= date('Ymd', $eventinfo['dateline_from']))
{
$todate_1 = date('Ymd', $eventinfo['dateline_to']);
$todate_2 = date('His', $eventinfo['dateline_to']-3600);
$fromdate_1 = date('Ymd', $eventinfo['dateline_from']);
$fromdate_2 = date('His', $eventinfo['dateline_from']-3600);
$fromdate = ':'.$fromdate_1 . 'T' . $fromdate_2;
$todate = ':'.$todate_1 . 'T' . $todate_2;
}
else
if ($eventinfo['dateline_to'] = $eventinfo['dateline_from'])
{
$todate_1 = date('Ymd', $eventinfo['dateline_from']);
$todate_2 = date('His', $eventinfo['dateline_from']-3600);
$fromdate_1 = date('Ymd', $eventinfo['dateline_from']);
$fromdate_2 = date('His', $eventinfo['dateline_from']-3600);
$fromdate = ';VALUE=DATE:'.$fromdate_1;
$todate = ';VALUE=DATE:'.$todate_1;
}
else
{
$fromdate_1 = date('Ymd', $eventinfo['dateline_from']);
$fromdate_2 = date('His', $eventinfo['dateline_from']-3600);
$fromdate = ':'.$fromdate_1 . 'T' . $fromdate_2;
$todate = ':'.fromdate;
}
$event_char = array("<br>", "<\br>", "\n", "\r");
$description_rep = str_replace($event_char, "\\n ", $eventinfo['event']);
$title_rep = str_replace($event_char, " ", $eventinfo['title']);
$vcdatestamp_1 = date('Ymd');
$vcdatestamp_2 = date('His');
$vcdatestamp = $vcdatestamp_1 . 'T' . $vcdatestamp_2;
$vcsoutput = 'BEGIN:VCALENDAR
VERSION:2.0
PRODID:fnlct_calendar
METHOD:PUBLISH
BEGIN:VEVENT
DTSTART' . $fromdate . '
DTEND' . $todate . '
LOCATION:
TRANSP:OPAQUE
SEQUENCE:0
UID:' .$eventinfo[eventid].'FNLP' .$fromdate. '
DTSTAMP:'.$vcdatestamp.'
DESCRIPTION:\\n'.$description_rep.'
SUMMARY:'.$title_rep.'
URL:http://sitename.org/discussions/calendar.php?do=getinfo&e='.$eventinfo[eventid].'
PRIORITY:1
X-MICROSOFT-CDO-IMPORTANCE:2
CLASS:PUBLIC
BEGIN:VALARM
TRIGGER:-PT60M
ACTION:DISPLAY
DESCRIPTION:Reminder
END:VALARM
END:VEVENT
END:VCALENDAR';
header('Content-type: application/download');
header('Content-Disposition: attachment; filename=FNLCT_Event_'. $eventinfo[eventid].'.ics');
echo($vcsoutput);
exit;
}
// ############################# end add to outlook ##########################
Like I said it creates the file fine and imports great but the times are wrong and no amount of fennegaling I do changes that.
zennifer
01-18-2007, 04:06 AM
Lots of views but no input. No one out there can figure this out?
marlita
01-22-2007, 06:19 PM
maybe this could be switched to a different forum, like a mod forum or something, since you've already got it almost figured out. that way, more people are likely to see it and maybe have the answer to fix that last little bit. i'd love to add this to my board once it's fixed re:time zones & ranged events. thanks
glowinggal
05-16-2007, 01:20 AM
ditto; I've found Icalendar and LOVE IT but would love to have the forum integration feature of course...
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.