2013-03-22 71 views
3

我需要捕獲outlook(2010)中任務的保存,但taskItem或檢查員都沒有看到這樣的事件。所以,我建立了密切的捕獲檢查:Microsoft Outlook自動化:捕獲保存事件

private void ThisAddIn_Startup(object sender, System.EventArgs e) 
{ 
    inspectors = this.Application.Inspectors; 
    inspectors.NewInspector += new Outlook.InspectorsEvents_NewInspectorEventHandler(Inspectors_NewInspector); 
} 

private void Inspectors_NewInspector(Outlook.Inspector inspector) 
{ 
    Outlook.TaskItem taskItem = inspector.CurrentItem as Outlook.TaskItem; 
    if (taskItem != null) 
    { 
     if (taskItem.EntryID == null) 
     { 
      ((Outlook.ItemEvents_10_Event)taskItem).Close += new Outlook.ItemEvents_10_CloseEventHandler(Task_Close); 
     } 
    } 
} 

如果我關閉檢查事件處理程序被調用,但是如果我點擊保存並關閉它不是。 底線是當用戶保存任務時我需要捕獲(以便我可以發佈主題。)是否有我可以使用的事件捕獲保存並關閉按鈕?

+0

不知道這篇文章是否會幫助你,但你有沒有看過這個傑西卡? http://www.codeproject.com/Articles/93288/Add-in-Programming也MSDN [Inspector.CurrentItem](http://msdn.microsoft.com/en-us/library/office/ff869722.aspx) – MethodMan 2013-03-22 14:57:14

+0

這個鏈接可能也有幫助http://www.add-in-express.com/forum/read.php?FID=5&TID=10910 – MethodMan 2013-03-22 15:00:59

+0

這一個似乎是最接近你在做什麼/尋找http:///go4answers.webhost4life.com/Example/save-close-outlook-e-mail-draft-without-51701.aspx – MethodMan 2013-03-22 15:03:09

回答

1

而不是定義「Outlook.TaskItem taskItem;」在本地,用全球可見度定義它。