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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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