2013-10-30 155 views
0

我搜索了這個東西,但沒有運氣呢。 我有一個加載項(用於Outlook),它在Outlook項目(約會項目,任務)上執行幾項操作。 我只想在將文件拖到項目主體上時覆蓋該事件,並將其顯示在項目主體上。我只是想要附加該項目(&將其存儲在我選擇的目錄中)。 如何鏈接活動? 雖然我發現了一個事件。Outlook項目c拖放覆蓋事件#

但在這個例子中,總是有一種形式。我沒有一個具體形式,因爲它是一個外接:(

private void Body_DragDrop(object sender, System.Windows.Forms.DragEventArgs e) 
    { 
     // Ensure that the list item index is contained in the data. 
     if (e.Data.GetDataPresent(typeof(System.String))) 
     { 

      Object item = (object)e.Data.GetData(typeof(System.String)); 

      // Perform drag-and-drop, depending upon the effect. 
      if (e.Effect == DragDropEffects.Copy || 
       e.Effect == DragDropEffects.Move) 
      { 

       // Insert the item. 
       System.Windows.Forms.MessageBox.Show("there"); 

      } 
     } 
    } 

我發現其餘的細節,但我無法找到重寫事件。

請幫助。 謝謝在

的信息提前:123

編輯::

我已經通過這些鏈接了

我將任命代碼:

public bool getAppointments(IList<IAppointmentData> list) 
     { 
      Microsoft.Office.Interop.Outlook.Application outlookApp = new Microsoft.Office.Interop.Outlook.Application(); 
      Microsoft.Office.Interop.Outlook.Explorer expl = outlookApp.ActiveExplorer(); 

      try 
      { 
       if (list.Count != 0) 
       { 
        deleteExisting(); 
        foreach (IAppointmentData appointmentData in list) 
        { 
         Microsoft.Office.Interop.Outlook._AppointmentItem appt = (Microsoft.Office.Interop.Outlook.AppointmentItem) 
          outlookApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olAppointmentItem); 
         appt = setMeetingDetails(appt, appointmentData); 

         appt.Recipients.ResolveAll(); 
         appt.Save(); 
        } 
       } 

      } 
      catch (System.Exception e) 
      { 
       System.Windows.Forms.MessageBox.Show(e.ToString()); 
       return false; 
      } 

      return true; 
     } 

我需要一些機制,當有人將文件放入人體提供上述的約會項目體列出的事件。 我該怎麼做?

+0

也許你可以發佈Outlook插件代碼作爲參考?您發佈的代碼(標準拖放處理程序)在這裏不是問題。您正試圖找出如何將其附加到Outlook插件。 –

+0

我想重寫拖放事件,就是這樣。可能嗎??我有通過代碼添加約會的正常代碼。我現在將編輯我的帖子。 –

回答

0

有沒有官方支持的API來做到這一點。我只能想到下降到Windows API級別:您可以找到編輯器控件的窗口句柄,然後使用RegisterDragDrop()安裝您自己的拖放處理程序。不知道你是否可以在C#中做到這點......在C++或Delphi中肯定是可行的。

+0

好的,非常感謝你的回覆。我想我必須嘗試不同的東西,也許使用標準文件打開對話框附加文件。 –