Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
I have an Outlook Addin That Adds a Group to the Ribbon with two buttons. It was working perfectly before I added the second button, but they have the same properties just different click handlers. It shows up in the correct place in the customize ribbon menu, but it is greyed out. What does it mean when it is greyed out and what could cause it? The addin is still loaded and wasn't deactivated for any reason that is on the list of reasons for why addins would be deactivated.
By following this question's answer:
Outlook addin Home tab with custom button
I was able to get the button to show on the read mail window on the main tab. The only differences from that answer are I used TabReadMessage rather than TabMail (as per the documentation). This worked perfectly until the 2nd button was added. You can see both buttons in the screnshot, Archive Message and Archive Message As.
See picture:
Anyone have any idea why this could be happening. Why would adding a second button make it stop showing up?
Is there a way to debug this and see what is occurring?
Any help would be appreciated as I've been searching for the answer for a while now.
Thanks
EDIT:
The generated code for my properties of my ribbon elements.
private void InitializeComponent()
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(OutlookRibbon));
this.tab1 = this.Factory.CreateRibbonTab();
this.group1 = this.Factory.CreateRibbonGroup();
this.button1 = this.Factory.CreateRibbonButton();
this.button2 = this.Factory.CreateRibbonButton();
this.tab1.SuspendLayout();
this.group1.SuspendLayout();
// tab1
this.tab1.ControlId.ControlIdType = Microsoft.Office.Tools.Ribbon.RibbonControlIdType.Office;
this.tab1.ControlId.OfficeId = "TabReadMessage";
this.tab1.Groups.Add(this.group1);
this.tab1.Label = "TabReadMessage";
this.tab1.Name = "tab1";
// group1
this.group1.Items.Add(this.button1);
this.group1.Items.Add(this.button2);
this.group1.Label = "Archive";
this.group1.Name = "group1";
this.group1.Position = this.Factory.RibbonPosition.BeforeOfficeId("GroupRespond");
// button1
this.button1.ControlSize = Microsoft.Office.Core.RibbonControlSize.RibbonControlSizeLarge;
this.button1.Description = "Archive Message";
this.button1.Image = ((System.Drawing.Image)(resources.GetObject("button1.Image")));
this.button1.Label = "Archive Message";
this.button1.Name = "button1";
this.button1.ScreenTip = "Archives Message";
this.button1.ShowImage = true;
this.button1.SuperTip = "Archives Message";
this.button1.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.button1_Click);
// button2
this.button2.ControlSize = Microsoft.Office.Core.RibbonControlSize.RibbonControlSizeLarge;
this.button2.Description = "Archive Message As";
this.button2.Image = ((System.Drawing.Image)(resources.GetObject("button2.Image")));
this.button2.Label = "Archive Message As";
this.button2.Name = "button2";
this.button2.ScreenTip = "Archive message in designated place";
this.button2.ShowImage = true;
this.button2.SuperTip = "Archives message in designated place";
this.button2.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.button2_Click);
// OutlookRibbon
this.Name = "OutlookRibbon";
this.RibbonType = resources.GetString("$this.RibbonType");
this.Tabs.Add(this.tab1);
this.Load += new Microsoft.Office.Tools.Ribbon.RibbonUIEventHandler(this.OutlookRibbon_Load);
this.tab1.ResumeLayout(false);
this.tab1.PerformLayout();
this.group1.ResumeLayout(false);
this.group1.PerformLayout();
EDIT 2:
All of a sudden every single addin a make even blank ones in VS cause the errror
Ribbon_GetDCVisible say Exception occurred while calling the function GetVisisble. Not sure why, but I turned on show UI errors so maybe this is greying them out? Not sure though because it is happening with every single addin. Even brand new blank ones.
–
–
–
–
The greyed buttons mean that your custom UI is disabled. Most probably you got an error in the markup or your code fires exceptions. Office applications disable add-ins that behave unexpectedly.
I have got a bunch of questions to the initial post, so decided to publish them as an answer as well. It will be hard to recognize them all as a comment. And any of them can lead to the resolution of the issue.
What XML markup do you have so far? Did you try to extract it from the ribbon designer?
Do you get any UI error in Outlook after adding another buttons? See How to: Show Add-in User Interface Errors for more information.
What exception do you have in the getVisible callback? Did you try to debug the code?
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.