2011-05-23 115 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

相關問題