C# .NET - Access denied error for COM class Id
Asked By Mitu N on 06-Jul-15 07:15 PM
Hi,
I've a C#/.Net windows service running on the server.It uses MS outlook Interop component(Microsoft.Office.Interop.Outlook.dll) to send emails to users.
When this code is executed, it gives following error.
System.UnauthorizedAccessException: Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (
Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
Could you advise please?
I tried setting permissionss using registry for above class id,but no luck.
Thanks in advance.
Robbe Morris replied to Mitu N on 07-Jul-15 07:12 AM
If I'm not mistaken, that is a UI oriented dll and cannot be run from inside a windows service. Either use the Microsoft Exchange Server web service API or convert your service to a console app and wire it up in Windows Task Scheduler to run every 30 seconds or so sending out the emails you have stored in a queue somewhere.