This isn't a true DASL filter, so you end up having to use ranges, in a sense. Unfortunately, you can't use Contains, DoesNotContain, etc. from the filter object reference, as you would with the Search objects. It's a little different.
The following will help you find a range of subjects all between 'test' and 'tz':
use strict;
use Win32::OLE qw(in with);
use Win32::OLE::Const 'Microsoft Outlook';
$|++;
$Win32::OLE::Warn = 3;
my $OL = Win32::OLE->GetActiveObject('Outlook.Application')
|| Win32::OLE->new('Outlook.Application', 'Quit');
my $NameSpace = $OL->GetNameSpace("MAPI");
my $Folder = $NameSpace->GetDefaultFolder(olFolderInbox);
my $Items = $Folder->{Items};
my $findtext = '[Subject] > "test" and [Subject] < "tz"';
my $MailItems = $Items->Find($findtext);
while (1) {
print $MailItems->{Subject} ."\n";
$MailItems = $Items->FindNext() || last;
}
And one should note the following (from the Outlook VB Reference):
Comparison operators allowed within the filter expression include >,<,
+<=, >=,= and <>.
Logical operators allowed are And Not and Or
Update: Slight modification to search string and Text from Find Object Reference.
C-.
---
Flex the Geek
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link or
or How to display code and escape characters
are good places to start.