Hello,
I have stumped at OLE Automation and trying to retrieve values.
Right now I cannot get my script to work, so I have to resort
to Visual Basic. Ahhhh!!!!
I am able to set a value, but I cannot retrieve it. :-(
Here's an example using Outlook...
WORKS ------------------------> $appointment->{start} = "03/20/2002 1:00:00 PM";
DOESN'T WORK -----------------> my $start = $appointment->{start};
FULL SOURCE EXAMPLE BELOW
thanks for any idea,
Joaquin Menchaca
##### SET VALUE - WORKS ######
use strict;
use Win32::OLE;
use Win32::OLE::Const 'Microsoft Outlook';
my ($interval, $start, $month, $day, $year);
my $today = time;
my $user = "test_user";
my $psswd = "";
my $i = 5; # number of days (used as offset from today)
my $Outlook = Win32::OLE->new('Outlook.Application', 'Quit') ||
die "FATAL ERROR: Cannot open Outlook!\n", Win32::OLE->LastError;
my $ol = Win32::OLE::Const->Load($Outlook);
my $namespace = $Outlook->GetNameSpace("MAPI");
my $logon = $namespace->Logon($user, $psswd, 1, 1);
my $appointment = $Outlook->CreateItem(olAppointmentItem);
$appointment->{Subject} = "Some Appointment";
$appointment->{Body} = "Let's chew the fat.\n";
$appointment->{Location} = "My Crib";
$interval = $i * 60 * 60 * 24; # start date is date + i number of days
$start = $today + $interval;
($day, $month, $year) = (localtime($start))[3,4,5];
$month++; $year+=1900;
$appointment->{start} = "$month/$day/$year 1:00:00 PM";
$appointment->save;
##### RETRIEVE VALUE - FAILS :'( ######
use strict;
use Win32::OLE;
use Win32::OLE::Const 'Microsoft Outlook';
my $user = "test_user";
my $psswd = "";
my $Outlook = Win32::OLE->new('Outlook.Application', 'Quit') ||
die "FATAL ERROR: Cannot open Outlook!\n", Win32::OLE->LastError;
my $ol = Win32::OLE::Const->Load($Outlook);
my $namespace = $Outlook->GetNameSpace("MAPI");
my $logon = $namespace->Logon($user, $psswd, 1, 1);
my $Folder = $namespace->GetDefaultFolder(olFolderCalendar);
my $appointment = $Folder->Items(1);
#### Retrieve startime HH:MM:SS format
my $start = $appointment->{start};
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs