Win32::OLE and CDO Message Filters

S

Shaun Clowes

Hi All,

I'm having some trouble trying to set the properites of the MessageFilter
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdo/html/_
olemsg_messagefilter_object.asp) object in a CDO messages collection using
Win32::OLE. Nothing I do seems to be able to change any of the properties. A
snippet of the code I'm trying:

print "We have a folder of type " . Win32::OLE->QueryObjectType($Folder) .
"\n";
print "The filter is of type " .
Win32::OLE->QueryObjectType($Folder->Messages->Filter) . "\n";
print "Currently filtering for size " . $Folder->Messages->Filter->Size .
"\n";
$Folder->{"Messages"}->{"Filter"}->{"Size"} = 12;
print "Currently filtering for size " . $Folder->Messages->Filter->Size .
"\n";
$Folder->Messages->Filter->LetProperty('Size', 12);
print "Currently filtering for size " . $Folder->Messages->Filter->Size .
"\n";
$Folder->Messages->Filter->SetProperty('Size', 12);
print "Currently filtering for size " . $Folder->Messages->Filter->Size .
"\n";

The output without -w:

We have a folder of type Folder
The filter is of type MessageFilter
Currently filtering for size
Currently filtering for size
Currently filtering for size
Currently filtering for size

The output with -w:

The filter is of type MessageFilter
OLE exception from "Collaboration Data Objects":

[Collaboration Data Objects - [MAPI_E_NOT_FOUND(8004010F)]]

Win32::OLE(0.17) error 0x8004010f
in METHOD/PROPERTYGET "Size" at AssignPrNumbers.pl line 65
Use of uninitialized value in concatenation (.) or string at
AssignPrNumbers.pl
line 65.
Currently filtering for size
OLE exception from "Collaboration Data Objects":

[Collaboration Data Objects - [MAPI_E_NOT_FOUND(8004010F)]]

Win32::OLE(0.17) error 0x8004010f
in METHOD/PROPERTYGET "Size" at AssignPrNumbers.pl line 67
Use of uninitialized value in concatenation (.) or string at
AssignPrNumbers.pl
line 67.
Currently filtering for size
OLE exception from "Collaboration Data Objects":

[Collaboration Data Objects - [MAPI_E_NOT_FOUND(8004010F)]]

Win32::OLE(0.17) error 0x8004010f
in METHOD/PROPERTYGET "Size" at AssignPrNumbers.pl line 69
Use of uninitialized value in concatenation (.) or string at
AssignPrNumbers.pl
line 69.
Currently filtering for size
OLE exception from "Collaboration Data Objects":

[Collaboration Data Objects - [MAPI_E_NOT_FOUND(8004010F)]]

Win32::OLE(0.17) error 0x8004010f
in METHOD/PROPERTYGET "Size" at AssignPrNumbers.pl line 71
Use of uninitialized value in concatenation (.) or string at
AssignPrNumbers.pl
line 71.
Currently filtering for size

Anyone have any ideas what I'm doing wrong?

Thanks,
Shaun
 
J

Jay Tilton

: I'm having some trouble trying to set the properites of the MessageFilter
: (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdo/html/_
: olemsg_messagefilter_object.asp) object in a CDO messages collection using
: Win32::OLE. Nothing I do seems to be able to change any of the properties.

: print "We have a folder of type " . Win32::OLE->QueryObjectType($Folder) .
: "\n";
: print "The filter is of type " .
: Win32::OLE->QueryObjectType($Folder->Messages->Filter) . "\n";
: print "Currently filtering for size " . $Folder->Messages->Filter->Size .
: "\n";
: $Folder->{"Messages"}->{"Filter"}->{"Size"} = 12;
: print "Currently filtering for size " . $Folder->Messages->Filter->Size .
: "\n";
: $Folder->Messages->Filter->LetProperty('Size', 12);
: print "Currently filtering for size " . $Folder->Messages->Filter->Size .
: "\n";
: $Folder->Messages->Filter->SetProperty('Size', 12);
: print "Currently filtering for size " . $Folder->Messages->Filter->Size .
: "\n";

[snip]

: The output with -w:
:
: The filter is of type MessageFilter
: OLE exception from "Collaboration Data Objects":
:
: [Collaboration Data Objects - [MAPI_E_NOT_FOUND(8004010F)]]
:
: Win32::OLE(0.17) error 0x8004010f
: in METHOD/PROPERTYGET "Size" at AssignPrNumbers.pl line 65
: Use of uninitialized value in concatenation (.) or string at
: AssignPrNumbers.pl
: line 65.

[truncated]

You have three different techniques for assigning a value to the
object's property. OLE is not complaining about any of them.

You have one technique for looking at the property's value. Each time
that technique is used, OLE complains about a missing "Size" method, and
perl complains about printing uninitialized values.

Reasonably, the problem is not that you cannot assign values, but that
you are using the wrong syntax for looking at them.

A look at the MessageFilter object docs says "Size" is a property of the
object, not a method.

print $Folder->Messages->Filter->{Size};
 
S

Shaun Clowes

Jay Tilton said:
You have three different techniques for assigning a value to the
object's property. OLE is not complaining about any of them.

Yes, but none are having any effect.
You have one technique for looking at the property's value. Each time
that technique is used, OLE complains about a missing "Size" method, and
perl complains about printing uninitialized values.

I've tried every other combination too.
A look at the MessageFilter object docs says "Size" is a property of the
object, not a method.

Yes, but Win32::OLE automagically does the right thing here. That's not my
problem.

Cheers,
Shaun
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,163
Latest member
Sasha15427
Top