Outlook Addin CommandBarButton Click Event Not Firing

S

Stu

Hi guys,

I am trying to get my VSTO 2005 addin to deploy to a test client machine.
The addin works fine on my development machine and is as simple as a custom
CommandBarButton on an appointment form that opens a .NET windows form that
users are required to fill out after creating each appointment. I have done
the following to get the addin to install sucessfully on the client machine:

- Installed WinXP and Windows Updated it as of 16th Jan 2006
- Installed Office 2003 SP2
- Added the PIA and VSTO Runtime as prerequisites to my addin install
application.
- Added necessary Code Access Security modifications to trust my application
implicitly.
- Installed the addin on the test client machine.

The addin installs fine and my buttons appear on the appointment items.
However, when run on the test client machine the button click events do not
fire at all. I have stuck some messagebox.show's as the first line in the
event handlers to ensure that it wasn't the child form failing without
bubbling the error up, but the messagebox does not get shown. I have included
my code that creates and handles the button and it's click event for
reference. I am completely stuck with this and so far my research is telling
me that I am the only person to get this behaviour :(:(

In the
outlookInspectors_NewInspector(Microsoft.Office.Interop.Outlook.Inspector
Inspector) event, I create my command bar button...
// Add the Edit Timesheet Information button.
_mailButton =
(Office.CommandBarButton)_shortcutBar.Controls.Add(Office.MsoControlType.msoControlButton, missing, missing, 1, 1);
_mailButton.Style = Office.MsoButtonStyle.msoButtonIconAndCaption;
_mailButton.Caption = "Edit Timesheet Information";
_mailButton.FaceId = 1106;
_mailButton.TooltipText = "Click here to display this appointment with all
timesheet information.";
_mailButton.Click += new
Office._CommandBarButtonEvents_ClickEventHandler(OnNewMailButtonClick);
_mailButton.Tag = new Guid().ToString();

My event handler then looks like this...
private void OnNewMailButtonClick(Office.CommandBarButton Ctrl, ref bool
CancelDefault)
{
try
{
MessageBox.Show("OnNewMailButtonClick fired");
}
catch (Exception ex)
{
MessageBox.Show("An error occured loading the Job information
screen: " + ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}

Appreciate any help,
 

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