Problem with custom action handler

M

Manisha S

Hi,

I have a very weird problem.
I'm trying to use c# to create a COM AddIn for Outlook.
I've added some custom actions to items in the Outlook
Contacts folder in the right click menu and some buttons in
the Outlook toolbar. Also, I've initialized a custom
action event handler like this -

//contIt is of type ContactItem
contIt.CustomAction += new
ItemEvents_10_CustomActionEventHandler( contIt_CustomAction
);
contIt.Save();

In the custom action handler (contIt_CustomAction), I show
a MessageBox for some of the custom actions and a windows
form for some other actions like this -

if(((Action)myAction).Name.Equals("Custom Action 1"))
System.Windows.Forms.MessageBox.Show("Custom Action 1");
else
if(((Action)myAction).Name.Equals("Custom Action 2"))
{
CustomForm1 custForm = new CustomForm1;
custForm.Show();
}

I find that when I right click on a Outlook Contact and
click on "Custom Action 1", everything works fine. But if
I click on "Custom Action 2", the windows form CustomForm1
is shown.

At this point, if I right click on a Outlook Contact and
select either Custom Actions 1 or 2, the event handler
stops getting called. So somehow, the event handler gets
lost after showing the windows form!

Could someone please help me with this?

Thanks!!
-Manisha.
 

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