While working with Microsoft Office Interoperability, you may face the following exception that states: "COMException (0x80080005): Retrieving the COM class factory for component with CLSID failed due to the following error: 80080005".
This issue happens when Outlook is already running and you are trying to access it's mailbox from Visual Studio environment. Let's discuss more about the issue.
If you see the following error "System.Runtime.InteropServices.COMException (0x80080005): Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80080005." while running your Office Interop app from Visual Studio, to read Outlook mailbox, it's nothing to do with the codebase. If you run this as a standalone app, it will work.
The possible reason is that the Outlook application is already running. If you close Outlook client and run the same app from Visual Studio, it works fine.
This error is caused by Visual Studio being run with admin privileges. If you encounter this error, restart Visual Studio as a normal user mode and run the application. The root cause of this issue is that, Outlook does not allow separate users to access the same mailbox. As Outlook is already running with normal privileges and you are trying to access it again but from Visual Studio with admin privileges, the error happened.