CAB Outlook bar

April 23rd, 2006

Chris Holmes, an active member of the CAB messageboards, blogged about
how to create an outlook bar and the corresponding CAB classes. Here you have a snapshot:

outlookbar

You can register the Outlook Bar…


OutlookBar outlookBar = RootWorkItem.Items.AddNew<OutlookBar>();

RootWorkItem.UIExtensionSites.RegisterSite("OutlookBar", outlookBar);

Then you can add/remove buttons to the bar…


Button button = new Button();

button.Text = "Payroll";

button.Image = MyProject.Modules.Payroll.Properties.Resources.payroll;

RootWorkItem.UIExtensionSites["OutlookBar"].Add

(button);

RootWorkItem.Commands["LoadPayrollWorkItem"].AddInvoker(button, "Click");

…and smartparts as well.


SomeSmartPart smartPart = this.Items.AddNew("OutlookBarSmartPart");

RootWorkItem.Workspaces["OutlookBarDeckWorkspace"].Show(smartPart);

Finally, another way to design this control is by creating a
custom IWorkspace that accepts a smartpart and a smartpartinfo that
holds the button information so you can do something like this:

OutlookBarSmartPartInfo info = new OutlookBarSmartPartInfo();

info.Text = "Payroll";

info.Image = MyProject.Modules.Payroll.Properties.Resources.payroll;

RootWorkItem.Workspaces["OutlookBar"].Show(smartPart, info);

Leave a Reply