|
Posted by Steve on 10/25/05 12:22
> I'm trying to develop a personal start page on my machine that would
> have my outlook calendar on the page. I've seen Konfabulator widgets
I'm feeling generous today... I couldn't get the filter to work in the
time available, so that's an exercise for the reader.
<?php
set_time_limit(0);
// 2005-10-25 sa [googlespam@nastysoft.com]
// no rights reserved, no refunds
define( 'olFolderCalendar', 9 );
$objOLApp = new COM("Outlook.Application") or die("Unable to
instantiate Outlook");
print "Outlook v" . $objOLApp->Version() . "<br><br>\n";
$objNameSpace = $objOLApp->GetNamespace('MAPI');
$objCalendarFolder = $objNameSpace->GetDefaultFolder(
olFolderCalendar );
$objCalendarItems = $objCalendarFolder->Items();
$objCalendarItems->IncludeRecurrences = 0;
$objCalendarItems->Sort( '[Start]' );
/* OT: SADLY, THIS FAILS TO FILTER ITEMS - ANYONE KNOW WHY? */
$objCalendarItem = $objCalendarItems->Find( '[Start]>="01-Jul-2005
12:00 AM"' );
while( $objCalendarItem )
{
$lngStartDate = $objCalendarItem->Start();
// manually filter - could take a long time...
if( $lngStartDate >= mktime( 0, 0, 0, 6, 1, 2005 ) )
{
$strStartDate = date( 'd-M-Y', $lngStartDate );
$strStartTime = date( 'H:i', $lngStartDate );
$lngDuration = $objCalendarItem->Duration() / 60;
switch( $lngDuration )
{
case 0: $strTimeDuration = $strStartTime . " (Reminder)";
break;
case 24: $strTimeDuration = "all day"; break;
default: $strTimeDuration = $strStartTime . " " . strval(
$lngDuration ) . " hrs"; break;
}
$strSubject = $objCalendarItem->Subject();
print $strStartDate . " - " . $strTimeDuration . " - " .
$strSubject . "<br>\n";
}
$objCalendarItem = $objCalendarItems->FindNext();
}
unset( $objCalendarItem );
unset( $objCalendarItems );
unset( $objCalendarFolder );
unset( $objNameSpace );
unset( $objOLApp );
?>
---
Steve
Navigation:
[Reply to this message]
|