In a recent Pet Project , I was working on an application which used the MS Office libraries, specifically the Outlook ones.
At almost the very start of the code I was trying to run the following :
Microsoft.Office.Interop.Outlook.Application app = null;
app = new Microsoft.Office.Interop.Outlook.Application();During runtime, the application was always throwing an exception while executing the 2nd line.
Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80080005.
After trying many options to correct it, I stumbled upon a document which dealt with some similar issues. I tried them and Lo, it worked..
Apparently these errors were triggered because I was running Outlook and the application on different user permission levels (one of them as administrator and the other one as regular user). I changed both to Administrator (since my VS.Net link is modified to open always in admin mode) and it all started working smoothly. Serendipity!!
N.B.: These errors only appear if I already have an Outlook 2010 instance started. If Outlook is not started, the application can run smoothly (it can start an Outlook instance by itself).