in reply to Filter(?) for Win32 OLE Find method

This is the best I could come up with. I can't find anyway except for looping through the messages.

Also make sure to import the in method, because it isn't imported by default.
#! /usr/bin/perl use strict; use warnings; use Win32::OLE qw( in ); #Outlook Application creation my $outlook = Win32::OLE->CreateObject('Outlook.Application'); my $ns = $outlook->getNamespace('MAPI'); my $inbox = $ns->GetDefaultFolder(6); #String to match my $match_str = 'test'; #Search the items foreach my $item (in $inbox->Items){ if($item->{Subject} =~ /^$match_str/i){ print "$item->{Subject} matches\n"; } }

Replies are listed 'Best First'.
Re: Re: Filter(?) for Win32 OLE Find method
by banduwgs (Beadle) on Aug 06, 2003 at 17:13 UTC

    Yes this is fine, but I don't like much looping through all items :-(. "Find" method seems fairly optimize on this perspective. It suports searching portions of string in VB scripts. That's why I thought that there should be a way to activate it in Perl as well

    Thanks a lot for your attention. Do you or any others... further comments please?? - SB