获取/在Windows 7中创建Outlook应用程序 [英] Getting/Creating an Outlook Application in Windows 7

查看:382
本文介绍了获取/在Windows 7中创建Outlook应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让Outlook中的当前运行的版本或启动Outlook中的情况下,它没有运行,但我有在Windows 7使用或创建Outlook应用程序对象的一些问题。我认为这是与用户特权时,在Vista中限制和7我与展望2010年工作



编辑:如果我已经有一个Outlook 2010实例启动这些错误才会出现。如果Outlook没有启动,应用程序都能流畅运行(也可以自行启动一个Outlook实例)。



如果有人能告诉我如何正确地获得Outlook应用程序版本,这将是真正的帮助。



我跑的代码是一个长期try-catch块上引发异常保留:

  

{
//创建Outlook
oApp =新Microsoft.Office.Interop的应用实例。 Outlook.Application();
}
赶上(System.Exception的前)
{

{
//以另一种方式
oApp =元帅得到展望。 GetActiveObject(Outlook.Application)作为Microsoft.Office.Interop.Outlook.Application;
}
赶上(System.Exception的EX2)
{
//尝试一些其他的方式来获取对象
oApp = Activator.CreateInstance(Type.GetTypeFromProgID( Outlook.Application))作为Microsoft.Office.Interop.Outlook.Application;
}
}

应用程序抛出我下面的例外情况:



当我尝试创建一个新的Outlook应用程序实例:




检索COM类工厂组件与CLSID {0006F03A-0000-0000-C000-000000000046}失败,原因是以下错误:80080005.


当我试图让Outlook应用实例:




操作不可用(从HRESULT异常:0x800401E3(MK_E​​_UNAVAILABLE))


当我尝试通过激活



,来创建一个实例

与CLSID检索COM类工厂组件{0006F03A-0000-0000-C000-000000000046}失败由于以下错误:80080005.


感谢您


解决方案

显然,这些错误被触发,因为我正在运行Outlook和对不同的用户权限级别(其中一个为管理员,另外一个为普通用户)应用程序。


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 restrictive in Vista and 7. I am working with Outlook 2010.

edit: These errors only appear if I already have an Outlook 2010 instance started. If Outlook is not started, the application can run smoothly (it can start an Outlook instance by itself).

If anybody can tell me how to correctly get the Outlook Application version, that would be really helpful.

The code I'm running is a long try-catch block that keeps on triggering exceptions:


try
{
  // create an application instance of Outlook
  oApp = new Microsoft.Office.Interop.Outlook.Application();
}
catch(System.Exception ex)
{
  try
  {
     // get Outlook in another way
     oApp = Marshal.GetActiveObject("Outlook.Application") as Microsoft.Office.Interop.Outlook.Application;
  }
  catch (System.Exception ex2)
  {
     // try some other way to get the object
     oApp = Activator.CreateInstance(Type.GetTypeFromProgID("Outlook.Application")) as Microsoft.Office.Interop.Outlook.Application;
  }
}

The application throws me the following exceptions:

When I try to create a new Outlook application instance:

Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80080005.

When I try to get the Outlook app instance:

Operation unavailable (Exception from HRESULT: 0x800401E3 (MK_E_UNAVAILABLE))

When I try to Create an instance through the Activator

Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80080005.

Thank you!

解决方案

Apparently these errors were triggered because I was running Outlook and the application on different user permission levels (one of them as administrator and the other one as regular user).

这篇关于获取/在Windows 7中创建Outlook应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆