title: Is it possible to catch "Send" event on Outlook 2010 add-in in a button's onAction function?
body: <p>Because I'm in the ribbon's class, there is no pointer to the Outlook.Application object. So, I cannot use </p>
  
  <pre><code>Application.ItemSend += new ApplicationEvents_11_ItemSendEventHandler(MyItemSendEventHandler)
  </code></pre>
  
  <p>this event handler.</p>
  
  <p>How can I reach Outlook.Application object in ribbon class or are there another way to catch send event?</p>
  
  <pre><code>public void SendEnMail(Office.IRibbonControl control) //OnAction Function
      {
          Outlook.Application oApp = new Outlook.Application();
          Outlook._MailItem myMail = (Outlook._MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem);
          myMail.Display(true);
          Outlook.Application application = Globals.ThisAddIn.Application;
          application.ItemSend += new Outlook.ApplicationEvents_11_ItemSendEventHandler(Application_ItemSend);
      }
      void Application_ItemSend(object Item, ref bool Cancel)
      {
          string a = ((Microsoft.Office.Interop.Outlook.MailItem)Item).Body;
          System.Windows.Forms.MessageBox.Show(a);
          Cancel = true;
      }
  </code></pre>
  
  <p>I cannot catch the ItemSend event like that. but if I write the eventhandler to ThisAddIn class</p>
  
  <pre><code> private void ThisAddIn_Startup(object sender, System.EventArgs e)
      {
           Application.ItemSend += new               Outlook.ApplicationEvents_11_ItemSendEventHandler(Application_ItemSend);
      }
  void Application_ItemSend(object Item, ref bool Cancel)
      {
          string a = ((Microsoft.Office.Interop.Outlook.MailItem)Item).Body;
          System.Windows.Forms.MessageBox.Show(a);
          Cancel = true;
      }
  </code></pre>
  
  <p>like this, it is working.</p>