How to know New button is clicked

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
 
K

Ken Slovak - [MVP - Outlook]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top