Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#978 OLE Outlook issue - Windows 7

v4.2.0
closed
Mark Miesfeld
oleObject (4)
complete
5
2014-04-15
2011-02-01
Anonymous
No

/ Rexx -------------------------------------------------------------/
/ /
/ you have to change OleFolder !!!!!! /
/ /
/ Outlook 2003 (11.8325.83299) SP3 used with Windows 2003 and /
/ Windows7 x64 /
/ /
/ Program works on Windows 2003 - error on Windows 7 /
/ /
/ Windows 7 trace : /
/ /
/ d:\oorexx\$Work>mailatta /
/ 19 - if ( mail_Item~unread ) /
/ >V> MAIL_ITEM => "an OLEObject" /
/ >M> "UNREAD" => "1" /
/ >>> "1" /
/ 19 - then /
/ 20 - mail_Item~Unread(false) /
/ >V> MAIL_ITEM => "an OLEObject" /
/ >V> FALSE => "FALSE" /
/ >A> "FALSE" /
/ 20 - mail_Item~Unread(false) /
/ Error 92 running D:\OORexx\$Work\MailAttA.rex line 20: OLE error /
/ Error 92.901: An unknown OLE error occurred (HRESULT=00000001). /
/ /
/-------------------------------------------------------------------/
call on Error

MS_Outlook = .OLEObject~New('Outlook.Application')
mapi = MS_Outlook~GetNameSpace('MAPI')

OleFolder = mapi~Folders('Postfach - Hugo, Habicht')~Folders('_AV')
OleItem = OleFolder~Items
count = OleItem~Count

do aa = count to 1 by -1
mail_Item = OleFolder~Items(aa)
trace i
if ( mail_Item~unread ) then ,
mail_Item~Unread(false)
trace o

end
return

/-------------------------------------------------------------------/

Error:
say 'Error in Line -' sigl '- RC =' rc
exit

Related

Bugs: #978

Discussion

1 2 > >> (Page 1 of 2)
  • Mark Miesfeld
    Mark Miesfeld
    2011-02-01

    Thanks for opening this. I don't have Outlook set up on my Windows 7 machine, so it might take me a week or two to take a good look at this.

    However, this looks suspicious to me:

    mail_Item~Unread(false)

    I think you should use .false On your Windows 7 system, try changing that and see if the error goes away.

     
  • Mark Miesfeld
    Mark Miesfeld
    2011-02-01

    I fooled around a little with an Outlook 2007 install I have access to on Windows XP.

    This is the correct syntax for marking an unread mail item as read:

    mail_Item~Unread = .false
    

    Try using that syntax on Windows 7 and see if things work.

     

  • Anonymous
    2011-02-02

    Microsoft Windows [Version 6.1.7600]
    Copyright (c) 2009 Microsoft Corporation. Alle Rechte vorbehalten.

    d:\oorexx\$Work>mailatta
    40 - if ( mail_Item~unread )
    >V> MAIL_ITEM => "an OLEObject"
    >M> "UNREAD" => "1"
    >>> "1"
    40 - then
    41 - mail_Item~Unread = .false
    >V> MAIL_ITEM => "an OLEObject"
    >E> .FALSE => "0"
    >A> "0"
    41 - mail_Item~Unread = .false
    Error 92 running D:\OORexx\$Work\MailAttA.rex line 41: OLE error
    Error 92.901: An unknown OLE error occurred (HRESULT=00000001).

    BTW : mail status is changed to read

     
  • Jon Wolfers
    Jon Wolfers
    2013-12-21

    For what it is worth:
    I also observe this unexpected behaviour with Windows7/Outlook 2007/ooRexx 4.1.0.
    As the outlook property change is performed, it is just a case of handling (ie: ignoring) the error.
    I suspect this is not an ooRexx problem, but an outlook one.
    Jon

    15 *-*             mail~unread = .true
    

    Error 92 running C:\ooRexx\test6.rex line 15: OLE error
    Error 92.901: An unknown OLE error occurred (HRESULT=00000001).

     
  • Mark Miesfeld
    Mark Miesfeld
    2013-12-21

    Hi Jon,

    Jon, thanks a lot for the comment, it caused me to think again about this.

    I noticed, again, that HRESULT is reported as 1. Since I had recently done a lot of work with COM objects in ooDialog, I remembered I had started using the SUCCEEDED() macro to test for return values from COM invocations. So I looked up the definition of the SUCCEEDED() macro in the Windows headers:

    //
    // Generic test for success on any status value (non-negative numbers
    // indicate success).
    //

    define SUCCEEDED(hr) (((HRESULT)(hr)) >= 0)

    1 is, obviously, greater than 0, so if the OleObject code used the SUCCEEDED() macro to test the return, there would be no exception generated.

    I think that is probably the correct answer here.

     
    • Jon Wolfers
      Jon Wolfers
      2013-12-21

      Hi Mark,

      Wow that was speedy - I thought I would just record that experience. I
      don't use outlook myself, but I was playing with it as one of my users uses
      it big-time. I stumbled upon that independently and thought it would help
      future coders to record my experience.

      Great if it leads to a fix. It might be hard for me to test a fix (not
      usiing outlook myself) - they just happened to leave their machine on over
      the weekend and I couldn't resist dialling in and trying a few things.

      I hope to get a chance to download and test the Beta soon.

      Jon

      On 21 December 2013 18:03, Mark Miesfeld miesfeld@users.sf.net wrote:

      Hi Jon,

      Jon, thanks a lot for the comment, it caused me to think again about this.

      I noticed, again, that HRESULT is reported as 1. Since I had recently done
      a lot of work with COM objects in ooDialog, I remembered I had started
      using the SUCCEEDED() macro to test for return values from COM invocations.
      So I looked up the definition of the SUCCEEDED() macro in the Windows
      headers:

      //
      // Generic test for success on any status value (non-negative numbers
      // indicate success).
      //
      define SUCCEEDED(hr) (((HRESULT)(hr)) >= 0)

      1 is, obviously, greater than 0, so if the OleObject code used the
      SUCCEEDED() macro to test the return, there would be no exception generated.

      I think that is probably the correct answer here.

      Status: open
      Created: Tue Feb 01, 2011 10:53 AM UTC by Anonymous
      Last Updated: Sat Dec 21, 2013 05:41 PM UTC
      Owner: nobody

      / Rexx -------------------------------------------------------------/
      / /
      / you have to change OleFolder !!!!!! /
      / /
      / Outlook 2003 (11.8325.83299) SP3 used with Windows 2003 and /
      / Windows7 x64 /
      / /
      / Program works on Windows 2003 - error on Windows 7 /
      / /
      / Windows 7 trace : /
      / /
      / d:\oorexx\$Work>mailatta /
      / 19 - if ( mail_Item~unread ) /
      / >V> MAIL_ITEM => "an OLEObject" /
      / >M> "UNREAD" => "1" /
      / >>> "1" /
      / 19 - then /
      / 20 - mail_Item~Unread(false) /
      / >V> MAIL_ITEM => "an OLEObject" /
      / >V> FALSE => "FALSE" /
      / >A> "FALSE" /
      / 20 - mail_Item~Unread(false) /
      / Error 92 running D:\OORexx\$Work\MailAttA.rex line 20: OLE error /
      / Error 92.901: An unknown OLE error occurred (HRESULT=00000001). /
      / /
      /-------------------------------------------------------------------/
      call on Error

      MS_Outlook = .OLEObject~New('Outlook.Application')
      mapi = MS_Outlook~GetNameSpace('MAPI')

      OleFolder = mapi~Folders('Postfach - Hugo, Habicht')~Folders('_AV')
      OleItem = OleFolder~Items
      count = OleItem~Count

      do aa = count to 1 by -1
      mail_Item = OleFolder~Items(aa)
      trace i
      if ( mail_Item~unread ) then ,
      mail_Item~Unread(false)
      trace o

      end
      return

      /-------------------------------------------------------------------/

      Error:
      say 'Error in Line -' sigl '- RC =' rc
      exit


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/oorexx/bugs/978/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       

      Related

      Bugs: #978

  • Jon Wolfers
    Jon Wolfers
    2013-12-21

    Here is a routine which quietly changes the unread property:
    / ===================== /
    ::routine markReadStatus
    / ===================== /
    use arg mail, status

    signal on syntax name outlookbug
    mail~unread = status
    outlookbug:
    signal off syntax
    / ===================== /

     
  • Mark Miesfeld
    Mark Miesfeld
    2013-12-21

    • labels: --> oleObject
    • status: open --> accepted
    • assigned_to: Mark Miesfeld
    • Pending work items: none --> code+test
     
  • Mark Miesfeld
    Mark Miesfeld
    2013-12-21

    From MSDN: http://msdn.microsoft.com/en-us/library/windows/desktop/ff485842(v=vs.85).aspx?ppud=4

    Error Handling in COM

    Probably 99% of COM methods return S_OK when they succeed; but do not let this fact mislead you. A method might return other success codes, so always test for errors by using the SUCCEEDED or FAILED macro. The following example code shows the wrong way and the right way to test for the success of a function call.

    // Wrong.
    HRESULT hr = SomeFunction();
    if (hr != S_OK)
    {
    printf("Error!\n"); // Bad. hr might be another success code.
    }

    // Right.
    HRESULT hr = SomeFunction();
    if (FAILED(hr))
    {
    printf("Error!\n");
    }

     
1 2 > >> (Page 1 of 2)


Anonymous


Cancel   Add attachments