none
C#: Outlook object failing when connecting to current instance? RRS feed

  • Question

  • The following code I have been using for 2 weeks successfully, now it fails on the 3rd line here (line 393 in exe). I have to make explicit call because of ambiguity between the word "Application." This is the example from this site with the update of the explicit calls.

    Microsoft.Office.Interop.Outlook.Application outApp = null;
    outApp = Marshal.GetActiveObject("Outlook.Application") as Microsoft.Office.Interop.Outlook.Application;
    MailItem mailItem = (MailItem)outApp.CreateItem(OlItemType.olMailItem);

    The message I receive is this (edited for confidentiality):

    "System.Runtime.InteropServices.COMException (0x800401E3): Operation unavailable (Exception from HRESULT: 0x800401E3 (MK_E_UNAVAILABLE))\r\n   at System.Runtime.InteropServices.Marshal.GetActiveObject(Guid& rclsid, IntPtr reserved, Object& ppunk)\r\n   at System.Runtime.InteropServices.Marshal.GetActiveObject(String progID)\r\n   at DS_Owner_Update.Form1.CreateMailItem(String person, String nm, String message) in C:\\Users\\Me\\Desktop\\DS\\DS Owner Update\\Form1.cs:line 393"

    Thanks


    SV

    • Moved by CoolDadTx Monday, January 5, 2015 7:00 PM Office related
    Monday, January 5, 2015 3:53 PM

Answers

All replies