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.
Related
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.
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'
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.
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.
I have created the necessary manifests for my COM server DLL and a client application to work registration-free in Windows XP. I've tested all kinds of combinations (with and without a registration) and in all cases the client application sees the side-by-side version of the library if the manifests are present, and the registered one if not (or a COM error if there is no registration at all). I've tested on my Windows XP development machine, and given the files (DLL, client EXE and one manifest for each) to co-workers, who've also run everything successfully on their own Windows XP machines. The manifests are external XML files, not embedded resources. So far, so good.
However, when I copy the files to a Windows Server 2003 machine, it doesn't work. I get a silent failure, but an application error in the Application Event Log (see below). If I unregister the DLL and remove the manifests, I get a similar error (silent at the command prompt, but an application error in the event log). Obviously there is some problem finding the registration. I have reproduced this on every Windows Server 2003 machine I can access at our company. According to the Microsoft documentation on side-by-side/registration-free COM, it's supposed to work on Windows XP and later, and Windows Server 2003 and later.
To be clear, the same client runs perfectly on those same Windows Server 2003 machines against a registered (i.e., using regsvr32) version of the same COM DLL, under the same login credentials I'm trying to use for registration-free COM. In other words, there are no intrinsic issues masquerading as registration-free COM problems - this client and server operate fine when the server is registered globally in the registry.
Anybody have any ideas of how to investigate further? I'm not an expert on Windows Server, but is there perhaps some policy setting that would need to be changed to enable this support? If I can locate the necessary change, our tech support/infrastructure people will probably have no probably doing it, but I can't rely on them to research the issue too as they are swamped.
In case it matters (I don't think it should, but you never know) the DLL is written in Delphi 2007, while the client is written in Visual C++.
Event Type: Information
Event Source: Application Error
Event Category: (100)
Event ID: 1004
Date: 5/2/2009
Time: 8:07:45 AM
User: N/A
Computer: ***server name****
Description:
Reporting queued error: faulting application ***program name***.exe, version 0.0.0.0, faulting module ***program name***.exe, version 0.0.0.0, fault address 0x0002ac9e.
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
One thing to look for is that whether the exe has an internal manifest. In XP, the exe manifest search order is external then internal. In Server 2003 and later, the order is internal then external.
With a COM server created in Delphi 7, I have seen similar problems if the COM server was unregistered and the client application started under a restricted user account, because Delphi's COM implementation always tried to update the registration information, even when the DLL's RegisterServer function was not explicitly called.
To see whether this is a problem, attempt to run the client application on an account with unrestricted administrative privileges.
MSDN mentions, that under Windows 2003, problems with registration free COM servers should be detailed in a specific section of the system event log:
When troubleshooting registration-free
COM issues, the Event Viewer on
Windows Server 2003 is your friend.
When Windows XP or Windows Server 2003
detects a configuration error it will
typically show an error message box
titled for the application you have
launched and containing the message
"This application has failed to start
because the application configuration
is incorrect. Reinstalling the
application may fix this problem." I
advise that whenever you see this
message you reproduce the problem on
Windows Server 2003, consult the
System Event Log and look for events
from the SideBySide source. The reason
I don't suggest that you look at the
Windows XP Event Log in these cases is
that it will invariably contain a
message such as "Generate Activation
Context failed for [path][application
filename].Manifest. Reference error
message: The operation completed
successfully," which doesn't help
identify the problem.
http://msdn.microsoft.com/en-us/library/ms973913.aspx#rfacomwalk_topic6
Also, if possible, tell us the file names and contents of the manifest files you use.