Here are a few issues in the order they occur within your script:

1. %start = $message_>{Start};
  
This should be:  

  my $start = $message->{Start};

You are trying to assign an odd number of elements to a hash, which is most 
likely not your intention.  Also, you meant "->" instead of "_>".  

2. $start_date = $message->{Start}->Date;
   $start_time = $message->{Start}->Time;

(optional) To eliminate the need to query the "Start" property two additional 
times per item, these statements can be better expressed as:

  $start_date = $start->Date;
  $start_time = $start->Time;

3. $end_date = $message->{PatternEndDate};

This line causes Win32::OLE to throw an exception:

Win32::OLE(0.1403) error 0x8002000e: "Invalid number of parameters"
    in METHOD/PROPERTYGET "PatternEndDate" at script.pl line 32

After a quick search online, it appears you may need to do the following 
instead:

  my $pattern = $message->GetRecurrencePattern;
  my $end     = $pattern->{PatternEndDate};

Keep in mind you'll still need to grab ->Date and ->Time from $end.

4. foreach $key (keys %start) {

Per #1 above, %start has been replaced with $start (a Win32::OLE::Variant 
object as someone else mentioned).  This means the foreach loop is no longer 
valid.


Turning on "use strict" makes a lot of these errors stand out.  I hope this 
helps.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of
Gallagher Timothy-TIMOTHYG
Sent: Friday, September 23, 2005 12:00 PM
To: [email protected]
Subject: Hashes


I have a question pertaining hashes.  I have a script that gets Outlook
calendar information and I an running into some problems.  I have this hash
:
[CODE]
        $message->{Start}; # start date
[/CODE]

$message->{START} contains many other values but I do not know what they
are.  So I try this:

[CODE}
        %start  = $message->{Start};
        For each $key(keys, %start) {
                Print "$start[$key] \n";
        } 
[/CODE]

I get nothing in return, I know that something is in there because if I say
print $message->{Start}  -> Date;  I get the date or if I print
$message->{Start}  -> Time;
I get the start time.  Can anyone tell me what I am doing wrong, here is the
rest of the code

Thanks, 
Tim
         
[CODE]


use Win32::OLE;
use Win32::OLE::Const 'Microsoft Outlook';


# Going to open a file to write too
# file location
        $output = "d:\\outlook_output\\output.txt";
        open(FD, "> $output") or die("Cant open $output\n");

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               = $message_>{Start};
   $start_date  = $message->{Start}->Date;
   $start_time  = $message->{Start}->Time;
   $end_date    = $message->{PatternEndDate};

   $duration    = $message->{Duration};
   $subject             = $message->{Subject};
   $location    = $message->{Location};
   $categories  = $message->{categories};
   $sensitivity = $message->{sensitivity};
   $body                = $message->{body};
   #%daysofweek = $message->{getrecurrencepattern};
 
 # spliting off the year and going to see if it is < 2005
 
   @s_date = split(/\//,$start_date);
  
   if($s_date[2] < '2005'){
        print "";
        
 # Want to make sure the date isnt a Holliday, they seem to have a duration
time of 1440
        }elsif($duration != "1440"){
                print FD
"*************************************************\n";
#               print FD "Start Date = $start_date\n"; 
#               print FD "Start Time = $start_time\n";
#               print FD "Duration = $duration\n";

#               print FD "Subject = $subject \n";
#               print FD "Location = $location \n";
#               print FD "Categories = $categories\n";
#               print FD "Sensitivity = $sensitivity\n";
#               print FD "Body = $body\n";
#               print FD "Daysofweek = " . %daysofweek . "\n";
#               print FD "Start** = " . %start . "\n";
#               print FD "Recurrence pattern :";
                        foreach $key (keys %start) {
#<----------------- This is the start hash
                                print FD "1" . $key . " " . $start{$key};
                        }
                        
        
        }
} 

close(FD);

[/CODE]
 
 
 
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to