RE: Displaying an Outlook Calendar on a webpage using PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, June 13, 2005 6:36 pm, Justin.Baiocchi@xxxxxxxx said:
> Hi, perhaps someone might be able to look at this code - it works when I
> run it from the command line, but not when viewed through a web page. I
> am running IIS 6 on Windows 2003 server.

The most likely problem is either:

Permisssions -- God only knows what the W2K3 user/permissions model is.
They changed it every version, and nobody understands it in the first
place. But whatever it is, your IIS runs_as a specific user, probably,
which PHP inherits, and that user just doesn't have permission to do what
you do on the command line.

Paths -- When you are on a command line, be it MS-DOS or CygWin or
whatever, you have specific $PATH (and/or $path) environment variables
set.  Your PHP user almost-for-sure has different $PATH settings.  Use
full pathnames for EVERYTHING.  Binaries, data files, everything.

Far less likely, but possible, if you've checked the above:

Are the PHP and MySQL versions the same in both your command line and
web-server installations?

Maybe find one of the 10 guys who actually understands W2K3
user/permissions system first.  That's not me. :-^

Oh, and finally...

You may want to consider just abandoning this Outlook crap and using
http://php.net/imap to manipulate the emails.  Won't help you with the
calendar stuff, though, I don't think, unless you can figure out that it's
all done with custom X-headers or something.

> Thanks
> Justin
>
>
> <?php
> $comobjOutlook = new COM("outlook.application") or die("Unable to
> instantiate outlook");
>
>
> $comobjOutlook -> Activate;
>
>
> # This is your mailbox name just like it appears in your Folders view.
> It might be 'Inbox' or something else.
> $targetmailboxname = "Mailbox - Baiocchi, Justin (CSIRO IT, Armidale)";
>
>
> # This is the folder you're looking for. In this case, I'm looking for
> calendar items, but you can look for
> # any folder. You need to add another loop to look for subfolders.
> Although there's probably a better
> # way, that's how I did it when I needed to get to Personal
> Folders/Inbox/Subfoldername
> $targetfoldername = "Calendar";
>
>
> $objNamespace = $comobjOutlook->GetNameSpace("MAPI");
> $objFolders = $objNamespace->Folders();
> $mailboxcount = $objFolders -> Count();
>
>
> $foundmailbox = FALSE;
> for ($i=1; $i<=$mailboxcount; $i++) {
>   $folderitem = $objFolders ->Item($i);
>   if ($folderitem -> Name == $targetmailboxname) {
>     $objMailbox = $folderitem;
>     $foundmailbox = TRUE;
>   }
> }
>
>
> $foundcal = FALSE;
> if ($foundmailbox) {
>   $objFolders = $objMailbox->Folders();
>   $foldercount = $objFolders -> Count();
>
>
>   for ($i=1; $i<=$foldercount; $i++) {
>     $folderitem = $objFolders -> Item($i);
>     if ($folderitem -> Name == $targetfoldername) {
>       $objCalendar = $folderitem;
>       $foundcal = TRUE;
>     }
>   }
>
>
>   if ($foundcal) {
>     $objItems = $objCalendar->Items();
>     $itemcount = $objItems->Count();
>
>
>     for ($i=1; $i<=$itemcount; $i++) {
>       $apptitem = $objItems -> Item($i);
>       $apptstart = $apptitem -> Start();
>       $apptend = $apptitem -> End();
>       $apptallday = $apptitem -> AllDayEvent();
>       $apptrecur = $apptitem -> IsRecurring();
>       $apptsubject = $apptitem -> Subject();
>       $apptlocation = $apptitem -> Location();
>
>
>       $secondsadj = $apptstart - 14400;
>       $startadj = date("m/d/Y H:i:s", mktime(0,0,$secondsadj,1,1,1970));
>
>
>
>       $secondsadj = $apptend - 14400;
>       $endadj = date("m/d/Y H:i:s", mktime(0,0,$secondsadj,1,1,1970));
>
>
>       if($apptallday) { $allday = "All Day"; } else { $allday = ""; }
>       if($apptrecur) { $recurring = "Recurring"; } else { $recurring ""; }
>
>
>       echo "$apptsubject @ $apptlocation\r\nFrom: $startadj To:
> $endadj\r\n";
>       if ($allday <> "" OR $recurring <> "") echo "$allday
> $recurring\r\n";
>       echo "\r\n\r\n";
>     }
>
>
>   } else {
>     die ("Did not find calendar folder");
>   }
>
>
> } else {
>   die("Did not find target mailbox: $targetmailboxname");
> }
> ?>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux