Click here to Skip to main content
15,881,803 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a PC with MS Office 2010 installed while the MS Outlook is installed from Office 2007.
On this PC the below code:
Microsoft.Office.Interop.Outlook.Application myOutlook = new Microsoft.Office.Interop.Outlook.Application();
string theName = myOutlook.Name;

results into the below 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: Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)).

I have deleted the below registry entry and the above code was working normally. As soon as the Windows Updates run, the below entry is inserted again and the above code raises the exception again.
HKEY_CLASSES_ROOT\TypeLib\{00062FFF-0000-0000-C000-000000000046}\9.4

1) The registry entry cannot be deleted from the application due to permissions
2) The two office versions are needed
3) The line "string theName = myOutlook.Name;" can be replaced by any line referencing the variable myOutlook with exactly the same result
4) The same code works perfectly on PCs with MS Office 2007 installed, including MS Outlook.

Any suggestion will be much appreciated.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900