Addin Outlook + Command bar

  • Thread starter Thread starter Raphael
  • Start date Start date
R

Raphael

Hello,
I would like to create a custom button (or custom command bar) in contact's
form.

I already created custom button on "standard" command ...
plzzzzzzz help :)


CommandBars oCommandBars;

CommandBar oStandardBar;

try

{

oCommandBars =
(CommandBars)applicationObject.GetType().InvokeMember("CommandBars",
BindingFlags.GetProperty , null, applicationObject ,null);

}

catch

{

object oActiveExplorer;

oActiveExplorer=
applicationObject.GetType().InvokeMember("ActiveExplorer",BindingFlags.GetProperty,null,applicationObject,null);

oCommandBars=
(CommandBars)oActiveExplorer.GetType().InvokeMember("CommandBars",BindingFlags.GetProperty,null,oActiveExplorer,null);

}

oStandardBar = oCommandBars["Standard"];

try

{

MyButtontest= (CommandBarButton)oStandardBar.Controls["MyButtontest"];

}

catch

{

object omissing = System.Reflection.Missing.Value ;

MyButtontest = (CommandBarButton) oStandardBar.Controls.Add(1, omissing ,
omissing , omissing , omissing);

MyButtontest.Caption = "test";

MyButtontest.Style = MsoButtonStyle.msoButtonIconAndCaption;

MyButtontest.Style = MsoButtonStyle.msoButtonIconAndWrapCaptionBelow;


MyButtontest.Tag = "Synchronisation";

MyButtontest.OnAction = "!<MyButtontest.Connect>";

MyButtontest.FaceId = 3199;

MyButtontest.Visible = true;

MyButtontest.Click += new
Microsoft.Office.Core._CommandBarButtonEvents_ClickEventHandler(this.MyButtontest_Click);

}


object oName =
applicationObject.GetType().InvokeMember("Name",BindingFlags.GetProperty,null,applicationObject,null);

oStandardBar = null;

oCommandBars = null;
 
Back
Top