How to know New button is clicked

  • Thread starter Thread starter Nagaraj
  • Start date Start date
N

Nagaraj

Hi,

I have the following code in my app

if (this.Application.ActiveExplorer().Selection.Count > 0)
{
Object selObject =
this.Application.ActiveExplorer().Selection[1];

if (selObject is Outlook.MailItem)
{
Outlook.MailItem mailItem =
(selObject as Outlook.MailItem);

XXXXXXXXXXXXXXXXXXXXXX

}
}

At the place XXXXXXXXXXXXXXXXXXXXXX
I want to know whether New button on the standard toolbar is clicked or not.
I want to do some calculations if New button is clicked.
Can anyone show me how to this in C# outlook plugin code?

Thanks
 
When New is clicked a new item is opened, which would fire the
Inspectors.NewInspector() event. You need to subscribe to that event to know
when that button is clicked.

As an alternative you can also get that control as a CommandBarButton object
in the "Standard" CommandBar and subscribe to the control's Click() event.
In that case you know it was clicked but that's it. You don't get a handle
to whatever was created. So using both events may be what you need to do
depending on exactly what you want.
 
Back
Top