Windows error 0x800401E3, -2147221021

Detailed Error Information

MK_E_UNAVAILABLE[1]

MessageOperation unavailable
Declared inwinerror.h

HRESULT analysis[2]

FlagsSeverityFailure
Reserved (R)false
OriginMicrosoft
NTSTATUSfalse
Reserved (X)false
FacilityCode4 (0x004)
NameFACILITY_ITF[2][1]
DescriptionThe source of the error code is COM/OLE Interface management.[2][1]
Error Code483 (0x01e3)

Questions

19votes
4answers

Exception from HRESULT: 0x800401E3 (MK_E_UNAVAILABLE) Workarounds

From the following call Marshal.GetActiveObject("Excel.Application") I get a > Operation unavailable (Exception from HRESULT: 0x800401E3 (MK_E_UNAVAILABLE)) I believe that this error is caused when the user permissions between my application and excel do not match. I want to know if there is a workaround as to how I can access [...] read more
c#
ms-office
16votes
5answers

Getting/Creating an Outlook Application in Windows 7

I'm trying to get the current running version of Outlook or start up Outlook in case it is not running, but I am having some issues in getting or creating the Outlook Application object in Windows 7. I think it has something to do with the user priviliges that are [...] read more
c#
windows-7
outlook
outlook-2010
15votes
3answers

Marshal.GetActiveObject() throws MK_E_UNAVAILABLE exception in C#

The following vbscript code works prefectly fine: Dim App Set App = GetObject("","QuickTest.Application") App.Quit But when I translate it into C# code as below: class Program { [STAThread] static void Main(string[] args) { object qtApp = Marshal.GetActiveObject("QuickTest.Application"); (qtApp as QuickTest.Application).Quit(); } } I get the exception: An unhandled exception of [...] read more
c#
com-interop
8votes
1answer

Marshal.GetActiveObject("Outlook.Application") throws MK_E_UNAVAILABLE when debugging with elevated privileges

This code run without problem in release r debug when Visual studio isn't started as an admin. Marshal.GetActiveObject("Outlook.Application"); However, when I start Vs as administrator and run the same line in debug, I get the following error: System.Runtime.InteropServices.COMException Operation unavailable (Exception from HRESULT: 0x800401E3 (MK_E_UNAVAILABLE)) How can I fix this. read more
c#
.net
visual-studio-2013
com-interop
elevated-privileges
6votes
2answers

Getting EnvDTE.DTE instance outside Visual Studio IDE

I am creating a project automation tool in Visual Studio 2013 where I have my own project template and I am trying to add it to an existing solution programatically.I am using the following code in a console application. EnvDTE.DTE dte = (EnvDTE.DTE)Marshal.GetActiveObject("VisualStudio.DTE.12.0"); string solDir = dte.Solution.FullName; solDir=solDir.Substring(0, solDir.LastIndexOf("\\")); dte.Solution.AddFromTemplate(path, [...] read more
c#
visual-studio-2013
envdte
5votes
1answer

Can't obtain Outlook.Application while Outlook is running until a non-Outlook window is in the foreground

Marshal.GetActiveObject("Outlook.Application") throws Operation unavailable (Exception from HRESULT: 0x800401E3 (MK_E_UNAVAILABLE)) when Outlook is started and continues while it is running until a non-Outlook window becomes the active foreground window. I am running Outlook Version 1901 Build 11231.20130 on Windows 10 Version 1803 Build 17134.523 (this is my local machine). I've observed [...] read more
c#
.net
outlook
office-interop
com-interop
3votes
4answers

Operation unavailable (Exception from HRESULT: 0x800401E3 (MK_E_UNAVAILABLE)) when running through Windows Service?

i am try to hook to outlook application from windows Service but getting an exception Operation unavailable (Exception from HRESULT: 0x800401E3 (MK_E_UNAVAILABLE)) here is my code. public void ItemSendEvent() { try { if (Process.GetProcessesByName(ApplicationConstants.OUTLOOK_PROCESS_NAME).Count() > 0) { // If so, use the GetActiveObject method to obtain the process and cast [...] read more
c#
.net
outlook
windows-services
ms-office
3votes
1answer

Env.DTE usage on Visual Studio 2012 throws sometimes MK_E_UNAVAILABLE

I am using Visual Studio 2012 I have a T4-Template within a project to generate Code from existing Code. For that, i use the Visual Studio Env.DTE-API. The same error as discribed will be thrown in a simple console application, so it cannot be a problem within my project. For [...] read more
visual-studio
exception
marshalling
envdte
3votes
2answers

COMException (0x800401E3): Operation unavailable (Exception from HRESULT: 0x800401E3 (MK_E_UNAVAILABLE)) with scheduled task

After searching on the web without success, here's my question. I've a task that i want to schedule to retrieve the attachment of an email from outlook and extract the data. It works fine when I launch the task manually but whenever I try to launch it through a scheduled [...] read more
c#
outlook
com-interop
2votes
2answers

How to get Excel.Application instance in C#?

I try to get Excel application in my code with this method: Excel.Application xlApp = GetApplication(); if (xlApp == null) xlApp = new Excel.Application(); where private Excel.Application GetApplication() { Excel.Application result = null; try { result = (Excel.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Excel.Application"); } catch (System.Runtime.InteropServices.COMException ex) { //Excel is not open } return result; [...] read more
c#
excel
interop
comexception
2votes
0answers

Marshal.GetActiveObject fails with OPERATION UNAVAILABLE, HRESULT: 0x800401E3 exception if elevation levels mismatch. What can I do?

I am writing a VB.NET add-on for Solidworks, in which I first need to connect to an already running instance of Solidworks (similarly to how such connections are made to Excel). I am using Marshal.GetActiveObject method: Sub ConnectToSolidworks() Const PROG_ID As String = "SldWorks.Application" Dim progType = System.Type.GetTypeFromProgID(PROG_ID) If progType [...] read more
vb.net
com-interop
solidworks
2votes
0answers

Why would a Windows service not be able to access the Running Object Table

I have a Windows service running in the background and I want at some point to tell him to get objects from the Running Object Table. The problem is that it seems impossible to achieve, whatever I try. It always fails at the GetObject method from the Windows API, failing [...] read more
c++
visual-c++
service
com
running-object-table
2votes
1answer

IOException raised despite IOException catch block

We have a Windows Forms application which connects to some web services. It lists the documents in the system, and when the user double-clicks one we download the file to the local computer and open the document for them to edit. Once the user closes the document then we upload [...] read more
c#
.net
2votes
0answers

How can I access objects in the Running Object Table (ROT) from within Internet Explorer's Protected Mode?

I have tried the following: * Setting HKLM\Software\Classes\AppID\{AppID}\ROTFlags to 0x1 (as recommended here) * Registering the object in the ROT with the ROTFLAGS_ALLOWANYCLIENT flag set. However, I always get a 0x800401e3 (Operation unavailable) error whenever I try to access the ROT object from within IE's protected mode. read more
internet-explorer
com
winapi
2votes
2answers

Connecting to an existing Outlook process

I'm building an application that opens existing mail messages in Outlook. The user may or may not already be running Outlook. All works well if Outlook is not running, but if it's already running I get a COM error (80080005). The internet seems to indicate that this can happen if [...] read more
c#
outlook
office-interop
1vote
2answers

getactiveObject command fails for windows 8 and windows 10

I have the following Powershell code below that i've compiled into an executable (.exe) file and have packaged it into SCCM to push against several 100 users. I have setup the SCCM package to run as "Install as user" and not as an Administrator. The package successfully captures the data [...] read more
c#
vba
powershell
outlook
sccm
1vote
0answers

Not able to open excel file when hosted in iis

I have a button wherein it opens an excel file in a pivot format which works perfectly fine with localhost but I get an issue when I host it to IIS it throws the below error : > Operation unavailable (Exception from HRESULT: 0x800401E3 (MK_E_UNAVAILABLE)) The code that i have [...] read more
c#
asp.net
excel
1vote
0answers

Word2PDF c# IIS Operation unavailable

Application is working fine in visual studio but when I try to run on LocalIIS 10 it stuck on infinite loading. I used this library "https://github.com/cognidox/OfficeToPDF". I already have given all the permission to "exe",destination Folder as well as set DCOM permission.I put the debugger the I found that It [...] read more
c#
asp.net
.net
iis
ms-office
1vote
1answer

How to Interop with Outlook when running with elevated privileges?

While debugging an issue with Outlook Interop, I noticed that when starting my process as an user that is part of the administrator group, my application works as expected. However running it as the same user under elevated privileges fails. The issue can be reproduced easily as it arises as [...] read more
c#
.net
outlook
office-interop
com-interop
1vote
2answers

Extracting/Scanning emails from Outlook using C#

I'm trying to make a windows form application that can be "hidden" in the taskbar (like WiFi and so on), equipped with a timer, and that every 10 seconds it scans my email inbox in Outlook. The first part works fine, but I can't get the scan to work. At [...] read more
c#
visual-studio
email
outlook
1vote
0answers

Visual studio throws exception even when "thrown" is disabled for the exception

In a library I've helper functions that get an active application instance using Marshal.GetActiveObject. Problem is when I'm debugging with visual studio it breaks on/throws the following exception: An exception of type 'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll and wasn't handled before a managed/native boundary Additional information: Operation unavailable (Exception from HRESULT: [...] read more
visual-studio
visual-studio-2013
1vote
0answers

How to solve a 0x800401E3(MK_E_UNAVAILABLE) error with IIS?

The preamble: We are developing a REST interface that gets live data from an embedded controller. There is a UI that talks to the embedded controller and has a COM interface that provides access to pertinent data. The REST interface connects via COM to get the necessary data. This all [...] read more
c#
iis
com
1vote
1answer

Problems accessing Outlook from c# Application

I'm writing a console application, which checks the contents of an outlook mailbox, in order to read the contents of specific emails into a database. This application works fine within Visual studio, whether or not Outlook is open. If I build the application and run it from the exe it [...] read more
c#
outlook
console-application
marshalling
office-interop
1vote
0answers

Instantiating a COM object when logged in as a different user

We're attempting to interact with an application running on a Windows XP box that provides a COM interface. When the application, which is NOT running as a service, is running as the same Windows user as our test code we're able to instantiate the COM interface and make calls against [...] read more
windows
com
1vote
0answers

Get Minitab active instance instead of creating new instance

I am trying to automate minitab with my C# program. I am able to open new minitab window with this code. MtbApp = new Mtb.Application(); MtbProj = MtbApp.ActiveProject; MtbUI = MtbApp.UserInterface; MtbUI.Visible = true; This code creates new minitab object and open new minitab window. Now, my problem is , [...] read more
c#
c#-4.0
process
com
minitab
1vote
3answers

c# use of unassigned local variable after Try..Catch

I am using the below code to get a running instance of MS Word. I now have a compile problem with 'Use of unassigned local variable "oWord"' here is my code: Microsoft.Office.Interop.Word._Application oWord ; try { // Is Word running? oWord = Marshal.GetActiveObject("Word.Application") as Microsoft.Office.Interop.Word.Application; // ApplicationClass; } catch (COMException [...] read more
c#
.net
interop
1vote
2answers

Failing to create an email with outlook interop when outlook has already been opened

How do you open an outlook window? I tried the code below but this doesn't work when an instance of outlook is already running - System.Diagnostics.Process[] processes = System.Diagnostics.Process.GetProcessesByName("OUTLOOK"); int processCount = processes.Length; if (processCount != 0) { **outlookApp = Marshal.GetActiveObject("Outlook.Application") as Microsoft.Office.Interop.Outlook.Application;** this is throwing the below error ** [...] read more
c#
wpf
mvvm
outlook
1vote
1answer

MK_E_UNAVAILABLE in Marshal.GetActiveObject("Word.Application")

0x800401E3 (MK_E_UNAVAILABLE) error occurs in my case when UAC (User Account Control) isn't set to the un-restrictive "Never Notify Me". Microsoft.Office.Interop.Word.Application wd = (Microsoft.Office.Interop.Word.Application) System.Runtime.InteropServices.Marshal.GetActiveObject("Word.Application"); The error is thrown when the code is run after publishing and installing the project. While debugging in the editor instead, everything is fine. Is [...] read more
c#
1vote
2answers

Microsoft.Office.Interop error 0x800401E3

I am trying to access Microsoft word instance through my service (windows service) but I am getting this error: > Operation unavailable (Exception from HRESULT: 0x800401E3 (MK_E_UNAVAILABLE)) I have opened a word document (I can also see WINWORD.EXE in the Task Manager). I am using VS 2010 and MS Office [...] read more
vb.net
office-interop
1vote
1answer

Problems getting access to a STA object from another process

I have been trying something which may turn to be impossible in the end. It's been a long while since I've been in COM land. Consider two apps and a COM STA DLL. First app loads COM STA DLL as a plugin and this DLL tries to register itself "globally" [...] read more
c++
com
marshalling
atl
0votes
0answers

Drag-drop issue after update of Designer and VS2017(HRESULT: 0x800401E3 (MK_E_UNAVAILABLE))

Had an issue where I couldn't drag and drop an entity into the designer. Cropped up after updating EF Designer and then VS2017 -------------------------------------------------------------------------------- Microsoft Visual Studio --------------------------- An error occurred while performing the drop: Operation unavailable (Exception from HRESULT: 0x800401E3 (MK_E_UNAVAILABLE)) --------------------------- OK Help --------------------------- ①developer prompt -> devenv [...] read more
visual-studio
visual-studio-2017
0votes
1answer

Strange behaviour when using Marshal.GetActiveObject("Outlook.Application")

In order to start outlook and wait until it's available via Interop I wrote the following Console app: static Outlook.Application outlook; static void Main(string[] args) { Console.WriteLine("Enter Profile:"); var profile = Console.ReadLine(); var process = Process.GetProcessesByName("Outlook").FirstOrDefault(); if (process == null) { ProcessStartInfo startInfo = new ProcessStartInfo("outlook.exe", $"/profile \"{profile}\""); // MK_E_UNAVAILABLE [...] read more
c#
outlook
office-interop
0votes
1answer

Create in-memory Excel file and open it in Excel without using COM Interop

I'm currently using COM Interop in .NET to export the contents of a DataTable to Excel. It's a method I've been using for years, but the problem is that COM is sketchy and throws random, intermittent, untraceable exceptions. This hasn't been a huge issue, since it's always just been code [...] read more
c#
excel
vb.net
openxml
com-interop
0votes
1answer

Outlook VSTO Add-in - Load Error 80080005

I have an Outlook add-in and it works fine. But, on the Outlook loading, my add-in shuts down and i got an error > Retrieving the COM class factory for component with CLSID > {0006F03A-0000-0000-C000-000000000046} failed due to the following error: > 80080005 Server execution failed (Exception from HRESULT: 0x80080005 [...] read more
vsto
outlook-addin
0votes
1answer

com exception excel InteropServices.COMException - c#

I am receiving System.Runtime.InteropServices.COMException when running the below method from main() I want to get true and later access the sheet if excel is opened on system. I am making sure excel is opened and sheet1 is there but I get false and the error above. using Excel = Microsoft.Office.Interop.Excel; [...] read more
c#
excel
com
comexception
0votes
0answers

"Marshal.GetActiveObject" gives COMException when getting reference to CorelDRAW

I'm developing a macro/application in VB.NET to perform some operations on the currently open document in CorelDRAW (2018 version). I'm trying to use the following code to use GetActiveObject() to acquire a reference to the currently open instance of Corel: Dim ActiveCorelApp As Corel.Interop.VGCore.Application = Nothing Try ActiveCorelApp = System.Runtime.InteropServices.Marshal.GetActiveObject("CorelDRAW.Application.20") [...] read more
vb.net
com
coreldraw
0votes
1answer

OutLook COMException 0x800401E3 (MK_E_UNAVAILABLE)

I'm trying an ASP.NET App and I have a problem with OutLook. Code behind : public Outlook() { // Check whether there is an Outlook process running. if (Process.GetProcessesByName("OUTLOOK").Count() > 0) { // If so, use the GetActiveObject method to obtain the process and cast it to an Application object. [...] read more
c#
outlook
0votes
0answers

Tracking with windows services

Hi there I'm trying to track, when a specific word files opens with windows services with these below technique but these Methods aren't working in windows services please help me, provide me a through which I can achieve that. 1. Dim wordApp As Microsoft.Office.Interop.Word.Application wordApp = Marshal.GetActiveObject("Word.Application") Exception occurred: Operation [...] read more
.net
vb.net
service
windows-services
interopservices
0votes
1answer

Marshal.GetActiveObject COM run time exception HRESULT 0x800401E3

I'm trying to get a hold of the excel application that is open. I'm using the Marshal.GetActiveObject("Excel.Application") method to do this. I open the excel workbook manually and then try and get a hold of it. There is only one instance of excel open so I'm not sure why I'm [...] read more
c#
0votes
1answer

C# Get running Outlook instance in VSTO add-in

I am trying to get an Outlook Application object in my add-in for Excel. If there's a running Outlook instance, it should get that, if there isn't any, it should create one, using the Outlook object model. This is the code I have right now: public static Outlook.Application GetApplicationObject() { [...] read more
c#
outlook
vsto
outlook-addin
0votes
0answers

Trying to access excel COM object as admin user

The objective is to access the running Excel workbook in the machine. Intention is to close the respective workbook though this application which was opened by the user. Achieved: I used the following code snippet to access the Excel COM object Excel.Application instance = null; try { instance = (Excel.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Excel.Application"); [...] read more
c#
excel
ms-office
comobject
0votes
1answer

How to start or attach to Outlook using Interop C#?

I'm trying to write a C# program that will either start a new instance of Outlook if none are running, or attach to the first instance if it happens to be running already. I've found a previous discussion already that pretty much identifies what I'm trying to achieve. The problem [...] read more
c#
outlook
com
interop
0votes
0answers

C# Marshal.GetActiveObject("PowerPoint.Application") Error

I'm working on a tool to get running power point program and control it so i used this code to get reference of running program. var pptApplication = Marshal.GetActiveObject("PowerPoint.Application") But it throws this erorr Operation unavailable (Exception from HRESULT: 0x800401E3 (MK_E_UNAVAILABLE)) I noticed that was happening because my app was [...] read more
c#
powerpoint
administrator
0votes
0answers

How can I call GetActiveObject on a process in another context?

Note: While my sample code is in Powershell, I could easily convert a C# sample into Powershell. I believe that C# developers are more likely to have encountered this issue, even though I am using Powershell to try and do this. I am trying to debug an issue with server-side [...] read more
c#
.net
powershell
com
0votes
0answers

How to create or get visio instance (visio is installed on app-v)?

I have Visio installed on app-v, the Microsoft tools for application virtualization. I run visio on my local machine, it works pretty well. But when writing a c# code on my local machine to get or create a Visio application like below : Microsoft.Office.Interop.Visio.Application application = (Microsoft.Office.Interop.Visio.Application)Marshal.GetActiveObject("Visio.Application"); I got the [...] read more
c#
visio
appv
0votes
1answer

How to automate Office 2013 on Windows 8.1

I'm trying to automate Outlook to send an email. The simplified code I'm using is: Dim outlook As Outlook.Application = Nothing Try outlook = New Outlook.Application Catch ex as Exception MsgBox(ex.Message) End Try Whenever I run it on Win8.1 with Outlook open I get the error message: > 8008005 Server [...] read more
vb.net
windows
outlook
automation
0votes
0answers

Marshal.GetActiveObject throws exception from esri c# addin

I want my esri addin to look for and use an existing instance of excel. The code: Microsoft.Office.Interop.Excel.Application exApp = null; try { exApp = (Microsoft.Office.Interop.Excel.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Excel.Application"); } catch (Exception err) {MessageBox.Show(err.ToString()); } GetActiveObject throws an exception every time, it doesn't matter if excel is running or not: exception from marshal.getactiveobject [...] read more
c#
add-in
arcmap
0votes
2answers

Autocad Instance not creating after deployment

I am getting an issue regarding running autocad application using C#. As i am beginner most of my code is copy pasted from net. The problem is i am developing an web application using c# which will create an instantiate autocad instance at runtime. Every thing goes fine on development [...] read more
c#
asp.net
iis-7
marshalling
autocad
0votes
0answers

CreateProcessWithLogon and Marshal.GetActiveObject("PowerPoint.Application")

I have to attach to PowerPoint automation object run from other user. It needs to avoid conflicts with my automation object of PPT and user instance of one. I created an internal windows user and use CreateProcessWithLogon(...) to start PowerPoint from its logon. Power Point is started normally and its [...] read more
c#
winapi
com
ms-office
powerpoint
-1votes
1answer

Using a 32bit COM-object in a 64bit environment

The code below executes without problems in a 32bit c#-application. object obj = system.Runtime.InteropServices.Marshal.GetActiveObject("Due.Application"); var due = (Due.IDueApplication2)obj; Now, I try to get the same code working in a 64bit c#-application and therefore I followed the instructions at http://www.gfi.com/blog/32bit-object-64bit-environment/ or http://www.codeproject.com/Tips/267554/Using-bit-COM-Object-from-bit-Application Two cases when running the 64bit application 1. Due [...] read more
c#
.net
com
32bit-64bit
com-interop
-2votes
1answer

Microsoft Word Interop performance issue

I have a winform program which loads Microsoft Word and performs some basic editing (find & replace), as well as some autosaving. It loads an existing word template, which again is basic text. The code for the interop is; try { // Is Word running? WordApp = System.Runtime.InteropServices.Marshal.GetActiveObject("Word.Application") as Microsoft.Office.Interop.Word.Application; [...] read more
c#
ms-word
interop

Comments

Leave a comment

(plain text only)

Sources

  1. winerror.h from Windows SDK 10.0.14393.0
  2. https://msdn.microsoft.com/en-us/library/cc231198.aspx

User contributions licensed under CC BY-SA 3.0