I'm trying to enumerate Outlook Global Address List and I don't have Outlook Client installed on a development server.
I'm getting following error
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll
Additional information: Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
on the following line
Application app = new Microsoft.Office.Interop.Outlook.Application();
I assume it's because Outlook Client is not installed. Is it possible to use Microsoft.Office.Interop.Outlook without it?
Anton,
I assume it's because Outlook Client is not installed. Is it possible to use Microsoft.Office.Interop.Outlook without it?
Interop files are used for marshalling calls between managed/unmanaged boundaries. There is no the unmananged side in your case (where to marshal the call).
As already was suggested, you can use EWS instead. See EWS Managed API, EWS, and web services in Exchange for more information.
I don't have Outlook Client installed on a development server.
Moreover, 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.
You can read more about that in the Considerations for server-side Automation of Office article.
It is not possible to use the Interop assemblies without its associated application installed where you need to use it. The Interop assemblies are used primarily as an advanced application automation system.
If you are using Exchange Server 2007 or later, you could consider using the technique described in this article which uses Exchange Web Services (EWS) to access the Global Address List instead: Querying the Global Address List (GAL) via Exchange Web Services (EWS)
Related
Hi I have created windows service c# to create an excel file. When I scheduled and running under my id in dev environment it is working fine. But when i run the same service with different interactive Id which is also an administrator account in the server, the service is failing at the line Excel.WORKBOOK.saveas(object) with the below error
"Microsoft Excel cannot open or save any more documents because there is not enough available memory or disk space." I have tried many solutions provided in net to provide permissions in comconfig and to create desktop folders in c:\windows\sys32 and syswow64.
But still unable to find it.. only with my id the service is running fine but any other interactive if it is failing. Please help
The Considerations for server-side Automation of Office article states the following:
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.
I'd suggest using the Welcome to the Open XML SDK 2.5 for Office if you deal only with open XML documents, otherwise you may consider using third-party components designed for the server-side execution.
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.*
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).
We are trying to open a Word template which resides on a Shared Drive using Office Interop Services on an MVC application.The solution is working locally, but once is deployed to the server the following message appears:
The File was not created: System.Runtime.InteropServices.COMException (0x800A1436): This file could not be found
ApplicationPool is running under a domain user account which already has permissions on the shared drive.
Any suggestion?
You may consider using the Open XML SDK for dealing with open XML documents (.docx), see Welcome to the Open XML SDK 2.5 for Office. Or any other third-party components designed for the server-sider execution (for example, Aspose).
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.
Kb257757 https://support.microsoft.com/en-us/help/257757/considerations-for-server-side-automation-of-office
Server-side automation of office is not supported using Interop, try using an XML based approach such as ClosedXML which is available from NuGet.
I am trying to use my asp.net application to open the outlook. It is working fine on my machine. now i am deploying the app to the server. i got this exception
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)).
I have been trying to solve this exception for three days. i googled a lot.
What I tried
they said that i have to go to DCOM CONFIG, i went there but I didn't find the microsoft office outlook entry.
then i opened a cmd and I typed mcc -32 and then i added the component server. after that i saw the outlook entry. i went to the property and then to the security tab, then i change the three of the options there to give access to the everyone user. but i kept having this problem
Note that I did that changes to these two entries
Microsoft Outlook Commadn Button
outlook message attachment
then i changed the user of the application bool to the Administrator account of the server, but i kept having the problem
please help me, i tried a lot really a lot to solve , but i couldn't
I am trying to use my asp.net application to open the outlook.
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.
As a workaround you can use the low-level API - Extended MAPI. Or any other third-party wrappers around that API (for example, Redemption).
First off, forgive me if this question appears amateur or has been answered in the past - I'm pretty new to programming in general and have tried to search for an answer.
I'm trying to write an executable that will access an Outlook mailbox, pick up an unread email and insert its details into a database for our records.
I've written a proof of concept application that I can run fine but when I try and call it through a stored procedure in Sql server I hit the error message:
Unhandled Exception: 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_
I imagine I'm hitting a security issue along the way but maybe, due to my inexperience, this simply isn't possible with Microsoft security settings?
So far I've tried:
-Using regsvr32 to register the .dll
-Changing the permissions of the .dll
-Setting up a Sql server proxy account that is the same login as the one I use to access the VM where the server is hosted
-Trying to run it using both late and early bound methods
Any advice would be greatly appreciated as I'm pretty stumped!
Thanks in advance guys.
Just because something can be done, doesn't mean it should :) Going from SQL Server to Outlook via xp_cmdshell has so many possibilities for failure that I wouldn't even contemplate it. You might get it working on one machine then find that you just can't get it working on another.
The simple way to do this would be a small .Net app; query Outlook + write to database. If you want it to work on a continual basis either use a scheduler or create a Windows service to perform the task every n minutes.
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.
I'd suggest choosing another model of calling/working with Outlook. For example, you can automate Outlook from a standalone application. See How to automate Outlook from another program for more information. Also you may consider developing an Outlook add-in which can synchronize emails on the fly (when they arrives).