0
votes

I am getting the below error when I try to access Outlook folder to download an attachment from my inbox. My code working perfectly when I run from Windows Form application. But when I use Windows Service to auto scan the Outlook folder, I am getting this issue.

*PollingService encountered an error 'Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80080005.'

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.*

1
Office automation from a service is not supported or recommended & of all the Office apps Outlook is the worst contender. See stackoverflow.com/questions/26403680/… for alternatives.Alex K.
@AlexK. Oooopsss !! If this is the case, I will have a hard time. Is there any way to use it? Or can I write a windows application(.exe) to do my task and run on scheduler?Rauf
Scheduler is also a service.Dmitry Streblechenko
Why specifically do you want to interact with Outlook from a service?Alex K.
There are various options to connect to Exchange from a service. You are probably best using EWS REST API. On the other hand, if you want to do something periodically with your own personal instance of Outlook, you probably want a scheduled task "run as" yourself, not a serviceBen

1 Answers

0
votes

Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.

If you are building a solution that runs in a server-side context, you should try to use components that have been made safe for unattended execution. Or, you should try to find alternatives that allow at least part of the code to run client-side. If you use an Office application from a server-side solution, the application will lack many of the necessary capabilities to run successfully. Additionally, you will be taking risks with the stability of your overall solution. Read more about that in the Considerations for server-side Automation of Office article.

As a workaround you may consider using a low-level API on which Outlook is built - Extended MAPI or any other third-party wrapper around that API (such as Redemption).