private void SetSPOCButton() { Microsoft.Office.Core.CommandBar cmdBar = this.Application.ActiveExplorer().CommandBars["Standard"]; //Try to get the existing Button spocButton = null; try { spocButton = (Microsoft.Office.Core.CommandBarButton)cmdBar.Controls["SPOC"]; } catch (System.Exception) { spocButton = null; } //If the button doesn't exist, create a new one if (spocButton == null) { spocButton = (Microsoft.Office.Core.CommandBarButton)cmdBar.Controls.Add(1, missing, missing, missing, false); } spocButton.Style = Microsoft.Office.Core.MsoButtonStyle.msoButtonIconAndCaption; spocButton.Caption = "SPOC"; spocButton.Tag = "SPOC"; spocButton.TooltipText = "SharePoint Outlook Connector"; ButtonHelper.GetInstance().SetButtonPicture(ref spocButton, ImageManager.GetInstance().GetSobiens20X20Image(), null); //Add a click handler for this button spocButton.Click += new Microsoft.Office.Core._CommandBarButtonEvents_ClickEventHandler(spocButton_Click); }