Ask a Question related to Ruby, Design and Development.
-
Steve Tuckner #1
[WIN32OLE] Outlook Automation Question
This is a multi-part message in MIME format.
------=_NextPart_000_00BC_01C33BD1.368279B0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
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::OlFolderI nbox)
i = 0
folder.items.each do |item|
if (item.FlagStatus == 2) then
item.FlagStatus = 1
end
end
------=_NextPart_000_00BC_01C33BD1.368279B0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"MSHTML 6.00.2600.0" name=3DGENERATOR></HEAD>
<BODY>
<DIV><SPAN class=3D537535015-26062003><FONT face=3DArial size=3D2>I am =
running a=20
script to grab emails out of my Outlook email box. I want to grab ones =
that I=20
have flagged and then I want to clear the flag however, the following =
code=20
doesn't work. It seems to read the flag status just fine (it looks like =
0 means=20
no flag, 1 means cleared flag, and 2 means flagged). Any=20
ideas?</FONT></SPAN></DIV>
<DIV><SPAN class=3D537535015-26062003><FONT face=3DArial=20
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D537535015-26062003><FONT face=3DArial size=3D2>Steve =
Tuckner</FONT></SPAN></DIV>
<DIV><SPAN class=3D537535015-26062003><FONT face=3DArial=20
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D537535015-26062003><FONT face=3DArial =
size=3D2>------- Code=20
-------------------</FONT></SPAN></DIV>
<DIV><SPAN class=3D537535015-26062003><FONT face=3DArial=20
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D537535015-26062003><FONT face=3DArial =
size=3D2>outlook =3D=20
WIN32OLE.new("Outlook.Application")<BR>namespace =3D=20
outlook.GetNamespace("MAPI")</FONT></SPAN></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><SPAN class=3D537535015-26062003><FONT face=3DArial size=3D2>class =
OutlookConst<BR>end</FONT></SPAN></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><SPAN class=3D537535015-26062003><FONT face=3DArial=20
size=3D2>WIN32OLE.const_load(outlook, OutlookConst)</FONT></SPAN></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><SPAN class=3D537535015-26062003><FONT face=3DArial =
size=3D2>folder =3D=20
namespace.GetDefaultFolder(OutlookConst::OlFolderI nbox)<BR></FONT></SPAN=face=3DArial size=3D2></FONT></DIV>><FONT=20
<DIV><SPAN class=3D537535015-26062003><FONT face=3DArial size=3D2>i =3D =
0<BR>folder.items.each do |item|<BR> if (item.FlagStatus =3D=3D 2) =
then<BR> item.FlagStatus =3D=20
1<BR> end<BR>end<BR></FONT></SPAN></DIV></BODY></HTML>
------=_NextPart_000_00BC_01C33BD1.368279B0--
Steve Tuckner Guest
-
Server side automation question
I want to do some time based house cleaning chores on a server based on server time/date. I know how to do it based on a call from the client using... -
WIN32OLE question
I'm using WIN32OLE with the Matrox ActiveMIL image processing library. For the most part things work fine but there's a function that won't work... -
Win32::OLE, Excel and OLE Automation question
"A. Sinan Unur" <asu1@c-o-r-n-e-l-l.edu> wrote in message news:<Xns93B9985BBBFFasu1cornelledu@132.236.56.8>... Thanks for the reply - I still got... -
OUTLOOK EXPRESS QUESTION: USERS
I have Windows XP home edition. I use Outlook Express for my email. If I want to make a new user account, can I copy my email account in Outlook... -
ASP.NET & Outlook automation error
I am trying to create an Outlook application object in my asp.net page, but i get a message saying it could not create instance of server. The... -
Steve Tuckner #2
Re: [WIN32OLE] Outlook Automation Question
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: [email]STUCKNER@MULTITECH.COM[/email]
> 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::OlFolderI nbox)
>
> 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!
> [url]http://sbc.yahoo.com[/url]Steve Tuckner Guest



Reply With Quote

