in reply to Re: Re: Win32::OLE and outlook
in thread Win32::OLE and outlook
You could, perhaps, try to rely on the fact that for a brand spanking new mail message, the Inspector has a caption (that is, its window has a title) of Untitled - Message (Plain Text)use Win32::OLE; use Win32::OLE::Const '.*Outlook'; # load the relevant constants my $ol = new Win32::OLE 'Outlook.Application'; my $inspectors = $ol->Inspectors; my @inspectors = Win32::OLE::Enum->new( $inspectors )->All; my @mail_items = grep { $_->Class == olMail } map { $_->CurrentItem } # get the MailItem object @inspectors;
Once you've found the element in @mail_items which is the one you want, you can extract its body text with the Body method, of course.my @mail_items = grep { $_->Class == olMail } map { $_->CurrentItem } # get the MailItem object grep { $_->Caption eq 'Untitled - Message (Plain Text)' } @inspectors;
jdporter
The 6th Rule of Perl Club is -- There is no Rule #6.
|
|---|