OLE Automation Runtime Error when using Outlook Interop

Discussion forum about all things Gupta, OpenText and the community.
gaiflo
Germany
Posts: 63
Joined: 29 Oct 2019, 12:00
Location: Berlin

OLE Automation Runtime Error when using Outlook Interop

Post by gaiflo » 24 Aug 2020, 15:38

We've got these Outlook classes which look like Outlook__MailItem or Outlook__Application.
Inside the Outlook_MailItem we've got lots of PropGet and PropSet methods which all do kind of like these Calls:

Code: Select all

!!CB!! 279
Function: PropGetReceivedTime
                Description:
                Returns
                               Boolean:
                Parameters
                               Receive Date/Time: returnValue
                                               !
                Static Variables
                Local variables
                               Boolean: tmpret
                Actions
                               Set tmpret = __ObjectInvoke("ReceivedTime", INVOKE_GET)
                               Call __ObjectPopDate(-1, returnValue)
                               Call __ObjectFlushArgs()
                               Return tmpret
I'm getting the error: "Error code at invocation of ReceivedTime: 800200006" . Sometimes i get the error with To instead of ReceivedTime.
How can i avoid theser errors as it crashes our whole application...

Dave Rabelink
Founder/Site Admin
Founder/Site Admin
Netherlands
Posts: 3145
Joined: 24 Feb 2017, 09:12
Location: Gouda, The Netherlands

Re: OLE Automation Runtime Error when using Outlook Interop

Post by Dave Rabelink » 26 Aug 2020, 08:00

I'm not sure. But it seems this error code is indicating the method or property does not exist on the object.
It also may be related to date/time datatype.
Could be that the data is not present.

Whatever the reason, to avoid that the application shows this error message and the application ends, you can disable this automatic error reporting and behavior.

I recommend to call this in the application startup or just before using any COM components:

Code: Select all

Call SalActiveXAutoErrorMode( FALSE )
When auto error mode is off, any call to a COM object will return FALSE and continue the application when COM errors occur.

So:

Code: Select all

If PropGetReceivedTime( dtMyTime )
   ! Data present and do your stuff
Else
   ! COM error, do your error handling and manage this properly without ending the application completely
Regards,
Dave Rabelink

Image
Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel

Return to “General Discussion”

Who is online

Users browsing this forum: [Ccbot] and 0 guests