I am running a script to grab emails out of
my Outlook email box. I want to grab ones that
I have flagged and then I want to clear the flag
however, the following code doesn’t work.
[snip]
That is because you are not “saving” the changes
Try this:
···
#---------------------------------------------------
require ‘win32ole’
outlook = WIN32OLE.new(“Outlook.Application”)
namespace = outlook.GetNamespace(“MAPI”)
class OutlookConst
end
WIN32OLE.const_load(outlook, OutlookConst)
folder =
namespace.GetDefaultFolder(OutlookConst::OlFolderInbox)
i = 0
folder.items.each do |item|
if (item.FlagStatus == 2) then
item.FlagStatus = 1
item.Save
end
end
#---------------------------------------------------
HTH,
– shanko
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com
Thanks, that worked great!
···
-----Original Message-----
From: Shashank Date [mailto:shanko_date@yahoo.com]
Sent: Thursday, June 26, 2003 4:34 PM
To: ruby-talk ML
Cc: STUCKNER@MULTITECH.COM
Subject: Re: [WIN32OLE] Outlook Automation Question
I am running a script to grab emails out of
my Outlook email box. I want to grab ones that
I have flagged and then I want to clear the flag
however, the following code doesn’t work.
[snip]
That is because you are not “saving” the changes
Try this:
#---------------------------------------------------
require ‘win32ole’
outlook = WIN32OLE.new(“Outlook.Application”)
namespace = outlook.GetNamespace(“MAPI”)
class OutlookConst
end
WIN32OLE.const_load(outlook, OutlookConst)
folder =
namespace.GetDefaultFolder(OutlookConst::OlFolderInbox)
i = 0
folder.items.each do |item|
if (item.FlagStatus == 2) then
item.FlagStatus = 1
item.Save
end
end
#---------------------------------------------------
HTH,
– shanko
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com