Hi - I've been trying to gain access to Outlook from php via COM with little luck..
Here's what I've come up with...
<?php
# OlDefaultFolders
$olFolderDeletedItems = 3;
$olFolderOutbox = 4;
$olFolderSentMail = 5;
$olFolderInbox = 6;
$olFolderCalendar = 9;
$olFolderContacts = 10;
$olFolderJournal = 11;
$olFolderNotes = 12;
$olFolderTasks = 13;
$olFolderDrafts = 16;
$olPublicFoldersAllPublicFolders = 18;
com_load_typelib("Outlook.Application");
echo "Outlook loaded...";
$Outlook = new COM("Outlook.Application") or die("Unable to load Outlook COM");
echo "com object created...";
$OutlookMAPI_Ns = $Outlook->GetNamespace("MAPI") or die("Unable to get Namespace");
echo "namespace created...";
$def_fld_inbox = $OutlookMAPI_Ns->GetDefaultFolder($olFolderInbox) or die("Unable to get olFolderInbox");
echo "got default folder.<br>";
$items_in_folder = $def_fld_inbox->Items->Count();
echo "Items in Inbox: $items_in_folder";
$Outlook->Quit();
$comr = com_release();
echo "Outlook Closed.";
?>
Unfortunatly I'm not a COM expert and finding one is incredibly difficult -
If I run this script on my box, it stalls at
com_load_typelib("Outlook.Application");
When watching Taskman when the script is executed a new php process is created and a new Outlook process is created. After a while the browser timesout, leaving the php and outlook processes still active [but not kill'able from TaskMan].
Any help would be apreciative.