View Single Post
Old 01-30-2008, 03:42 AM   #6 (permalink)
Orc
The Prestige
 
Orc's Avatar
 
Join Date: Dec 2007
Posts: 1,044
Thanks: 193
Orc is on a distinguished road
Default

Quote:
Originally Posted by Alan @ CIT View Post
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
That'll only work on Windows, :<
__________________
VillageIdiot can have my babbies ;d
Orc is offline  
Reply With Quote