01-27-2008, 02:18 PM
|
#4 (permalink)
|
|
The Frequenter
Join Date: Apr 2005
Location: South UK
Posts: 483
Thanks: 51
|
Ok, since no-one else entered I might as well post my code :) It doesn't take user input purely because I'm too lazy to make a form, but you get the idea
PHP Code:
<?php
/**
* Generates a new task and adds it to Outlook
* This PHP script must be run on the same machine as Outlook for it to work
*/
// Connect to Outlook using the Com interface
try
{
$comOutlook = new Com('Outlook.Application');
}
catch (Exception $e)
{
die('Unable to connect to Outlook: ' . $e->getMessage());
}
// Create the new task
try
{
$newTask = $comOutlook->CreateItem(3);
// Task details - full list of properties: http://msdn2.microsoft.com/en-us/library/bb177256.aspx
$newTask->Subject = 'Visit TalkPHP';
$newTask->Body = 'Do not forget to visit TalkPHP today!';
$newTask->DueDate = '01/28/08';
// Save the new task
$newTask->Save();
echo 'Task Added';
}
catch (Exception $e)
{
die('Unable to create new task: ' . $e->getMessage());
}
Screenshot of the new task in Outlook: http://i77.photobucket.com/albums/j4...n/outlook1.jpg
Alan
Last edited by Alan @ CIT : 01-27-2008 at 02:55 PM.
Reason: Cleaned up the code a little bit
|
|
|