我正在嘗試一個ASP.NET應用程序,並且出現OutLook問題。背後OutLook COMException 0x800401E3(MK_E_UNAVAILABLE)
代碼:
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.
OutlookApplication = Marshal.GetActiveObject("Outlook.Application") as Application;
}
else
{
// If not, create a new instance of Outlook and log on to the default profile.
OutlookApplication = new Application();
NameSpace nameSpace = OutlookApplication.GetNamespace("MAPI");
nameSpace.Logon("", "", missing, missing);
nameSpace = null;
}
}
}
當我玩然後應用程序:
System.Runtime.InteropServices.COMException(0x800401E3):操作不> disponible(例外德HRESULT:0x800401E3(MK_E_UNAVAILABLE ))
我已經閱讀:
我猜想你以管理員身份運行Visual Studio(通過以管理員身份運行啓動),而以用戶身份打開Outlook時,他以Windows登錄身份登錄。所以Visual Studio在不同於Outlook客戶端的用戶下運行。
但我不知道如何解決它。
再說一遍,這非常不是[標籤:asp-classic],它甚至不好笑。 – Martha