[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. It seems to read the flag
status just fine (it looks like 0 means no flag, 1 means cleared flag,
and 2 means flagged). Any ideas?

Steve Tuckner

------- Code -------------------

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
end
end