I am trying to read messages from an Outlook Inbox, process the data in the 
message, and send a reply (also using some of the data from the message). 
 So far I have found a lot of great information here. (Thanks especially to 
Chuck Charbeneau).

I am now able to read the To, Subject, and Body of the messages, but am 
having trouble with the From information.  Here is the code I have so far, 
and the error I am getting.

<code>
use strict;
use Win32::OLE qw(in with);
use Win32::OLE::Const 'Microsoft Outlook';

$Win32::OLE::Warn = 2; # Throw Errors, I'll catch them

my $OL = Win32::OLE-> GetActiveObject('Outlook.Application')  or die 
"cannot";
Win32::OLE-> LastError();

my $NameSpace = $OL-> GetNameSpace("MAPI");
my $Folder = $NameSpace-> GetDefaultFolder(olFolderInbox);

my $count = 0;

   foreach my $msg (in $Folder-> {Items})
        {
        if ($msg-> {Subject} =~ m/^\.[A-Z][A-Z][A-Z][A-Z][A-Z][A-Z][A-Z]/)
                {
                my $subj = $msg-> {Subject};
                my $bod = $msg-> {Body};
                my $to = $msg-> {To};
                my $from = $msg-> {From};
                print ("$subj \n");
                print ("$bod \n");
                print ("$to \n");
                $count = $count + 1;
                }
        }

print ("$count");
</code>


I get the following error, then the rest of the info prints correctly.
Win32::OLE(0.1701) error 0x8002000e: "Invalid number of parameters"
    in METHOD/PROPERTYGET "From" at C:\ole-test.pl
line 22


Any help would be appreciated.

Julie

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

Reply via email to