Happy-Jack has asked for the wisdom of the Perl Monks concerning the following question:

I am sort of new to Perl and I have been trying to work with OLE and Outlook Calendar. I am parsing the calendar but I am having troubles with getting the reminders function. This is the part that I am having troubles and cannot find out what I am doing wrong ($message->{AppointmentItem}->ReminderMinutesBeforeStart;)
Thanks for any information.
Happy
Here is what I have:
use Win32::OLE; use Win32::OLE::Const 'Microsoft Outlook'; # Going to open a file to write too # file location my $outlook = Win32::OLE->new('Outlook.Application') or die "Error!\n"; my $namespace = $outlook->GetNamespace("MAPI"); my $folder = $namespace->GetDefaultFolder(olFolderCalendar); my $items = $folder->Items; print length($folder) . "\n"; for my $itemIndex (1..$items->Count) { my $message = $items->item($itemIndex); next if not defined $message; $start_date = $message->{Start}->Date; $start_time = $message->{Start}->Time; $end_date = $message->{End}->Time; $end_time = $message->{End}->Time; $duration = $message->{Duration}; $subject = $message->{Subject}; $categories = $message->{Categories}; $body = $message->{Body}; $reminder = $message->{AppointmentItem}->ReminderMinutesBeforeSt +art; # AppointmentItem.ReminderSet print "*****************************************\n"; print "Start Date " . $start_date . "\n"; print "Start Time " . $start_time . "\n"; print "End Date " . $end_date . "\n"; print "End Time " . $end_time . "\n"; $duration_1 = ($duration / 60); print "Duration " . $duration_1 . " hrs\n"; print "\n"; print "\n"; print "Subject " . $subject . "\n"; print "Categories " . $categories . "\n"; print "Body " . $body . "\n"; print "Reminder " . $reminder . "\n"; }

Replies are listed 'Best First'.
Re: Perl and outlook
by NetWallah (Canon) on Sep 28, 2005 at 20:25 UTC
    You can get ReminderMinutesBeforeStart Directly from the $message object.
    Here is a modified segment (tested) of your code:
    ---<snip>--- my $CalendarFolderItems = $folder->Items; print length($folder) . "\n"; for my $itemIndex (1..$CalendarFolderItems->Count) { my $CalendarItem = $CalendarFolderItems->item($itemIndex); next if not defined $CalendarItem; $start_date = $CalendarItem->{Start}->Date; $start_time = $CalendarItem->{Start}->Time; $end_date = $CalendarItem->{End}->Time; $end_time = $CalendarItem->{End}->Time; $duration = $CalendarItem->{Duration}; $subject = $CalendarItem->{Subject}; $categories = $CalendarItem->{Categories}; $body = $CalendarItem->{Body}; $reminder = $CalendarItem->{ReminderMinutesBeforeStart}; # AppointmentItem.ReminderSet print "*****************************************\n"; ---<snip>---

         "Man cannot live by bread alone...
             He'd better have some goat cheese and wine to go with it!"

      Thank you so much this was somthing driving me crazy.