UiPath StudioX - Outlook Desktop Application COM add-in error - outlook

UiPath Community,
I am unable to utilize any of my Outlook automations using UiPath StudioX. Whenever I run the sequence, I encounter the following error message: "RemoteException wrapping System.Reflection.TargetInvocationException: Property accessor ‘Account’ on object ‘UiPath.Mail.Activities.Business.OutlookApplicationCard’ threw the following exception:‘Unable to cast COM object of type ‘Microsoft.Office.Interop.Outlook.ApplicationClass’ to interface type ‘Microsoft.Office.Interop.Outlook._Application’. This operation failed because the QueryInterface call on the COM component for the interface with IID ‘{00063001-0000-0000-C000-000000000046}’ failed due to the following error: Interface not registered (Exception from HRESULT: 0x80040155).’ —> RemoteException wrapping System.InvalidCastException: Unable to cast COM object of type ‘Microsoft.Office.Interop.Outlook.ApplicationClass’ to interface type ‘Microsoft.Office.Interop.Outlook._Application’. This operation failed because the QueryInterface call on the COM component for the interface with IID ‘{00063001-0000-0000-C000-000000000046}’ failed due to the following error: Interface not registered (Exception from HRESULT: 0x80040155). "
I would highly appreciate your help and explanation to resolve the problem.
enter image description here

It seems your windows registry keys are messed up. This is a widely spread issue when dealing with COM libraries. Here is what the Error: Unable to cast COM object of type 'Microsoft.Office.Interop.Outlook.ApplicationClass' to interface type 'Microsoft.Office.Interop.Outlook._Application'. thread states:
Sounds like you have a problem with your typelib registration. Presumably, the Com interop layer is hitting the registry to try to locate the typelib. It would start by looking under HKCR\Interface{00063001-0000-0000-C000-000000000046}\Typelib. The default value should refer to the guid for the typelib that defines the interface in question: which should be located under the following key: HKCR\Typelib{00062FFF-0000-0000-C000-000000000046}. There should be a version subkey and then a 0 subkey, and a win32 subkey under that. The default value of the win32 key should point to the typelib (which is msoutl.olb).
I'd recommend you check your Office directory for msoutl.olb. If it is there, try running 'regtlib msoutl.olb'. You should have regtlib on your machine is part of your Visual Studio install, I believe. Anyway, reregistering the typelib will rewrite all of the necessary keys to the registry. You will need administrative privileges for this operation.
The other possibility is that msoutl.olb itself is corrupt, in which case reinstalling Outlook should fix the problem.
Try to "repair" your Microsoft Office installation. Go to Programs and Features, select Modify and then Repair Online.
FYI I'd recommend contacting UiPath StudioX for further troubleshooting.

Related

UIPATH - Send Outlook Mail (Unable to cast COM object)

I want to set up a robot able to send e-mails thank's to the UIPATH activity "Send Outlook Mail".
but a receive this error message :
Send Outlook Mail Message: Unable to cast COM object of type 'Microsoft.Office.Interop.Outlook.ApplicationClass' to interface type 'Microsoft.Office.Interop.Outlook._Application'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{00063001-0000-0000-C000-000000000046}' failed due to the following error: Interface not registered (Exception from HRESULT: 0x80040155).
Some people on internet seem to have managed to correct this problem due to the versioning of Outlook. But my problem seems different because I only have the versions 8.7 listed in the IID : HKEY_CLASSES_ROOT\TypeLib{00020905-0000-0000-C000-000000000046}
It seems your windows registry records are messed. Try to "repair" your Microsoft Office installation. Go to Programs and Features, select Modify and then Repair Online.
This is a widely spread issue when dealing with COM libraries. Here is what the Error: Unable to cast COM object of type 'Microsoft.Office.Interop.Outlook.ApplicationClass' to interface type 'Microsoft.Office.Interop.Outlook._Application'. forum thread states:
Sounds like you have a problem with your typelib registration. Presumably, the Com interop layer is hitting the registry to try to locate the typelib. It would start by looking under HKCR\Interface{00063001-0000-0000-C000-000000000046}\Typelib. The default value should refer to the guid for the typelib that defines the interface in question: which should be located under the following key: HKCR\Typelib{00062FFF-0000-0000-C000-000000000046}. There should be a version subkey and then a 0 subkey, and a win32 subkey under that. The default value of the win32 key should point to the typelib (which is msoutl.olb).
I'd recommend checking your Office directory for msoutl.olb. If it is there, try running 'regtlib msoutl.olb'. You should have regtlib on your machine is part of your Visual Studio install, I believe. Anyway, reregistering the typelib will rewrite all of the necessary keys to the registry. You will need administrative privileges for this operation.
Also you may find the Outlook issue - Unable to cast COM object of type 'Microsoft.Office.Interop.Outlook.ApplicationClass' page helpful.

Using Microsoft.Office.Interop.Outlook to get Outlook app and get MAPI Namespace fails

I am attempting to migrate an x86 application that reads MailItems from Outlook.exe running on an old PC (64 bit Windows 7 Ultimate, retail Office x86) to a newer PC (64 bit Windows 10 Pro, Office 365 x86). I am using VS2010 on both PCs. I have "Embed InterOp Types" = TRUE.
The app fails when getting the the Application and Namespace from Outlook (see code and exception below). I have reason to believe that I am not referencing the right Outlook .dll(s) or PIAs. I have searched the web for current information that might apply to my configuration. The best I have found is Cannot add reference to Outlook 2016 (Office 365) Interop (16.0.0.0)
The Solution to that question suggests two fixes. "Force the app to x86 or install Office 365 as 64 bit"
The rational is that Visual Studio will only register 64-Bit versions of .dll(s) to the GAC on 64-Bit Windows.
In my case, the app has always been x86 and Office 365 is and must be x86. I use MS Access and Excel VBA Modules and both work as expected with no problem with their referenced .dll(s).
My Question: Which .dll(s) should I be referencing and where can I find them or do I need to DirectCast something?
Details:
The code below is an extract of the problem code. Only the two lines before and following the "Try" actual matter to this question.
Imports Microsoft.Office.Interop.Outlook
'Code and Declarations dealing wih GUI and Data structure setup
...
'Called from Form.Shown Handler
Private Sub GetMessages()
Dim app As Microsoft.Office.Interop.Outlook.Application = Nothing
Dim ns As Microsoft.Office.Interop.Outlook.NameSpace = Nothing
Try
app = New Application() 'Executes ... but
ns = app.GetNamespace("MAPI") 'Throws Exception
ns.Logon(Nothing, Nothing, False, False)
'....Code to read the MailItems....
Catch ex As System.Runtime.InteropServices.COMException
Debug.WriteLine(ex.ToString())
Finally
ns = Nothing
subFolder = Nothing
inboxFolder = Nothing
'app.Quit() 'probably not needed
app = Nothing
End Try
End Sub
When run, the above code throws the below exception at the GetNamespace call.
Unable to cast COM object of type 'Microsoft.Office.Interop.Outlook.ApplicationClass' to interface type 'Microsoft.Office.Interop.Outlook._Application'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{00063001-0000-0000-C000-000000000046}' failed due to the following error: Element not found. (Exception from HRESULT: 0x8002802B (TYPE_E_ELEMENTNOTFOUND)).
Of course, my code depends on having the right references. I got to this point by copying the Solution from the old PC to the new PC. I then loaded it into VS2010 and rebuilt it. This Rebuild changed the references to:
Microsoft.Office.Core -- C:\WINDOWS\assembly\GAC_MSIL\Office\15.0.0.0__71e9bce111e9429c\Office.dll
Microsoft.Office.InterOp.Outlook -- C:\WINDOWS\assembly\GAC_MSIL\Microsoft.Office.Interop.Outlook\15.0.0.0__71e9bce111e9429c\Microsoft.Office.Interop.Outlook.dll
Try to "repair" your Microsoft Office installation. Go to Programs and Features, select Modify and then Repair Online. It seems your windows registry keys were messed up. Read more about such issues:
Unable to cast COM object of type Microsoft.Office.Interop.Outlook
Outlook issue - Unable to cast COM object of type 'Microsoft.Office.Interop.Outlook.ApplicationClass'

ADODB.Connection in VB6 - Open Method fails with Runtime Error '2147221164 (80040154)'

This is something that start to happen on a project on which I am working, and so far I was not able to figure out the root cause.
This stopped working without any change from my side, the only thing I know has changed since the last time I worked on that project is that a disk failed (used to be the E: drive on which some applications were installed).
Operative System is Windows Server 2003.
Below the error:
Runtime Error
The Libraries I am adding to the project are the following:
Visual Basic For Applications
Visual Basic runtime objects and procedures
Visual Basic objects and procedures
OLE Automation
Microsoft CDO for Windows 2000 Library
Microsoft Scripting Runtime
Windows Scripting Host Object Model
Microsoft Data Binding Collection VB6 (SP4)
Microsoft ActiveX Data Objecrs 2.8 Library
The object oConn is declared and instantiated the following way:
Dim oConn AS ADODB.Connection
Set oConn = New ADODB.Connection
No reference is marked as MISSING in the VB Project.
I also tried the late binding, but without success. I tried to use regsrv32.exe to reregister msado15.dll, but no joy.
I am really out of idea here, I think that some dependencies are no longer satisfied due to the failure of the disk, but I don't know how to investigate this given the few details provided by the IDE.
Thanks
This question has no easy answer. What I found, and has been also suggested in the comment by #Jim Hewitt, is that MDAC on Windows Server 2003 was corrupted. The component checker is not actually able to identify the version of MDAC, which is an embedded component in that version of Windows.
So, summarizing, the whole windows installation is corrupted (no idea on how this could have happened) and Visual Basic 6 doesn't work properly. The solution has been to setup another machine.

Class not registered when I try to run setup

I created a setup by Advanced Installer software for my program that I've written by c#. I installed my program on VMWare Windows7.
When I try to run it this message is displayed:
Here is a topic about COM registration: "Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))"
If it is a simple COM/Class registration, you should add them to COM page in your Advanced Installer project.
If you don't know what to add them to COM page you can also use this method to register them.
I used an API function in my program that checks internet connection,I think this function does not work on VmWare

System Error &H80004015 (-2147467243). The class is configured to run as a security id different from the caller

When try to debug the VB dll Using Visual Studio 6.0 , I am getting the the following error. Can you any one tell me what needs to be done for this?
System Error &H80004015 (-2147467243).
The class is configured to run as a
security id different from the caller
I have had the same problem.
Created a few ActiveX DLLs and put the binaries into a COM+ Application, which runs under a specific account (not mine). Then I use these components inside ASP script pages using Server.CreateObject().
If I load the source code into VB for debugging and try to run it ("Start with Full Compile") I get this error message.
The cause of this is that the account registered in the COM+ Application differs from my own account from which I try to run.
Solution for this particular case is to Shutdown the COM+ Application and remove the components. When finished debugging, compile the set of DLLs and put them back to the COM+ application.
Hope someone is helped by this :-)
My solution was to unreference the dll in the Visual Basic project (Project Menu -> References), close the dialog box and reference it once again. I ran the project and everything is working again. I did not have to edit the windows registry.
There's a knowledge base article that seems to apply to your situation:
PRB: System Error Message "&H80004015" When You Run ActiveX DLL in Visual Basic IDE
Cause: When Visual Basic runs an ActiveX DLL from the IDE, it calls the CoRegisterClassObject application programming interface (API) to temporarily register the server. This creates the AppId and specifies it to run in the Interactive User context.
This problem occurs because of a bug in the Microsoft OLE Libraries 4.0, which are included with the Microsoft Platform Software Development Kit (SDK). CoRegisterClassObject fails with the error message that is listed in the "Symptoms" section of this article under the following conditions:
If the ActiveX server that calls the API is set to run by using the Interactive User identity.
-and-
The string that is associated with the following registry key contains any value other than a single valid executable name for the shell process:
HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon Shell=
Under Microsoft Windows 2000, this error occurs when the Certification Authority service does not start.
Resolution: Make sure that the HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon Shell= registry key contains a single valid executable name for the shell process.
To resolve this problem under Windows 2000, you can install the "Client for Microsoft Network" component and then reboot.

Resources