2011-05-23 92 views
2

我开发了一个访问Outlook的.NET应用程序。对于我的电脑来说,它工作的很好,但是当我公开发布它并将其运行到其他PC时,Outlook会显示一个弹出窗口,提示“外部应用程序想要访问Outlook,授予1/2/5/10分钟访问权限”。授予访问Outlook应用程序

但我的应用程序想要访问超过10分钟。这将是什么解决方案?

我的猜测:

  1. 我怎样才能使这个应用程序在前景值得信赖?
  2. 我的电脑前景从来没有问过我为什么其他电脑需要访问时间?这是因为我在我的系统上开发了应用程序吗?

编辑

我发现这里http://www.add-in-express.com/outlook-security/

但同样的事情时,我复制的代码:

AddinExpress.Outlook.SecurityManager SecurityManager = new AddinExpress.Outlook.SecurityManager(); 
SecurityManager.DisableOOMWarnings = true; 
try { 
// ... any action with protected objects ... 
} finally { 
    // In any case please remember to turn on 
    // Outlook Security after your code, 
    // since now it is very easy to switch it off! :-) 
    SecurityManager.DisableOOMWarnings = false; 
} 

这stament被显示为错误:

AddinExpress.Outlook.SecurityManager

我必须使用哪个命名空间,我正在使用.NET 2.0。

以下是我已经列入我的.cs的命名空间文件

using System; 
using System.Collections.Generic; 
using System.ComponentModel; 
using System.Data; 
using System.Drawing; 
using System.Text; 
using System.Windows.Forms; 
using Microsoft.Office.Interop; 
using System.Reflection; 
using Microsoft.Office; 
using System.Runtime.InteropServices; 
using OutLook = Microsoft.Office.Interop.Outlook; 
using System.Reflection; 
using System.Text; 
using System.Configuration; 
using System.Security; 

回答

1

警告“功能”被称为object model guard

如果Outlook 2007在具有最新防病毒软件的系统上运行,将不会弹出警告,因此其他计算机可能没有AV或运行安全中心API无法查询状态的AV。

如果您使用VSTO插件访问Outlook,您可以通过调用可信的ThisApplication对象(链接示例)绕过警卫,如果您使用的是vanilla interop,则需要执行其他操作(例如Redemption)。

+0

谢谢。我现在可以理解,为什么我没有在我的电脑中弹出任何内容,因为我使用的是Outlook 2007.但其他的电脑使用的是Outlook 2003.有什么方法可以禁用弹出式应用程序吗? – Chris 2011-05-23 10:53:39

+0

另一个问题是,我无法在其他PC上安装任何其他软件,我将在其中运行我的应用程序。 – Chris 2011-05-23 10:55:54

+0

下面是关于ol2k3缓解的一些信息; http://msdn.microsoft.com/en-us/library/aa168346%28v=office.11​​%29.aspx – 2011-05-23 10:58:44