use Win32::OLE; use strict; use warnings; # Note colours use constant olBlue => 0; use constant olGreen => 1; use constant olPink => 2; use constant olWhite => 4; use constant olYellow => 3; # General use constant olSave => 0; # Item types use constant olNoteItem => 5; use constant olTaskItem => 3; # Task priorities use constant olImportanceHigh => 2; use constant olImportanceLow => 0; use constant olImportanceNormal => 1; # Task status use constant olTaskComplete => 2; use constant olTaskDeferred => 4; use constant olTaskInProgress => 1; use constant olTaskNotStarted => 0; use constant olTaskWaiting => 3; # Note that the setting for the work values is in minutes. # 60 * 20 is 20 hours but that is 2x8 + 4 or 2 and a half # 8 hour days. # To enter a complete task change the entry to True my $options = { 'MessageClass' => "IPM.Task", 'Body' => "Test task", 'Importance' => olImportanceHigh, 'Subject' => "This is a task that you should do fool", 'DueDate' => "01/03/2002", 'StartDate' => "01/03/2002", 'TotalWork' => 60 * 20, 'ActualWork' => 60, 'Companies' => "Bodgit and Scarper", 'Complete' => "False", 'PercentComplete' => 24, 'Status' => olTaskInProgress, 'Mileage' => "Loads, its a good runner", 'BillingInformation' => "Cost center 101", 'ReminderSet' => "True", 'ReminderPlaySound' => "True", 'ReminderSoundFile' => "reminder.wav", 'ReminderTime' => "01/03/2002", }; my $Outlook = Win32::OLE->GetActiveObject('Outlook.Application'); # Create a task my $task = $Outlook->CreateItem(olTaskItem); # Write Note Title & Body while (my ($key,$val) = each %{$options}) { $task->{$key} = $val; } # Close and Save note. $task->Close(olSave);