Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
use strict; use warnings; use Win32::OLE; use Win32::OLE::Const 'Microsoft Outlook'; $|++; #get an Outlook object my $outlook; $outlook = Win32::OLE->new('Outlook.Application'); die unless $outlook; #get the Inbox folder my $namespace = $outlook->GetNamespace("MAPI"); my $folder = $namespace->Folders("My Folder"); my $n = $folder->Items->Count; my $i=0; my $from; for ($i=$n; $i>0; $i--) { $from = $folder->Items($i)->{'SenderEmailAddress'}; if ($from eq "sender@myemail.com") { if ($folder->Items($i)->{'Unread'}) { $folder->Items($i)->{'Unread'}=0; + #<--- this works print "Is it? before - ".$folder->Items($i)->{'IsMarkedAsT +ask'}."\n"; #<--- always returns 0 $folder->Items($i)->MarkAsTask(0); + #<--- I don't think this works print "Is it? after - ".$folder->Items($i)->{'IsMarkedAsT +ask'}."\n"; #<--- always returns 0 print "Cats before: ".$folder->Items($i)->Categories."\n"; while ($folder->Items($i)->Categories ne "NAC12182") { $folder->Items($i)->{'Categories'}="NAC12182"; + #<--- this doesn't work } print "Cats after: ".$folder->Items($i)->Categories."\n"; } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using Win32::OLE to set categories in Outlook 2007
by bart (Canon) on Apr 29, 2009 at 18:36 UTC | |
by jdavidson (Initiate) on Apr 29, 2009 at 18:44 UTC | |
by Anonymous Monk on Apr 29, 2009 at 18:38 UTC | |
|
Re: Using Win32::OLE to set categories in Outlook 2007
by jdavidson (Initiate) on May 01, 2009 at 05:21 UTC | |
by meredib (Acolyte) on Nov 05, 2009 at 17:19 UTC |