in reply to Using Win32::OLE to set categories in Outlook 2007

Hooray, I figured it out!
Hopefully this helps someone else out there one day:

I had to first:

my $thisItem;  #<-- this is imperative!

then:

$thisItem = $folder->Items($i); if ($thisItem->{'Unread'}) { ...etc...

and replace every instance of

$folder->Items($i)

with

$thisItem

Then it works like a charm!!
Also don't forget to save changes at the end of changing each email:

$thisItem->Save();

Yay!

Replies are listed 'Best First'.
Re^2: Using Win32::OLE to set categories in Outlook 2007
by meredib (Acolyte) on Nov 05, 2009 at 17:19 UTC
    Do you know how to send emails with Office 2007? Since upgrading I can't seem to figure it out. To create new messages I had the following code:
    $msg = $session->Outbox->Messages->Add();
    And now I get the following error message:"Can't call method "Messages" on an undefined value at"