outlook add in add tabs in runtime - c#

I using vs 2013 .NET 4.5.1 c#
how can I add tabs to outlook ribbon in runtime?
I try :
Microsoft.Office.Tools.Ribbon.RibbonTab OneNewTab;
OneNewTab = this.Factory.CreateRibbonTab();
OneNewTab.SuspendLayout();
OneNewTab.Label = "newtab";
OneNewTab.Name = "newtab;
this.Tabs.Add(OneNewTab);
but I Get :
An exception of type 'System.InvalidOperationException' occurred in
Microsoft.Office.Tools.Common.Implementation.dll but was not handled
in user code Additional information: Collection is read only. Cannot
change content of the collection.

You need to add tabs at design time and make them visible and run-time.

The Ribbon UI is a static thing. You can't add new tab on your own at runtime.
The Fluent UI extensibility model is based on the IRibbonExtensibility interface. The host application calls the GetCustomUI method implemented in your add-in to get the custom UI markup. So, you can't do so at runtime.
As a workaround you can define the getVisible callback and call the IRibbonUI.Invalidate or IRibbonUI.InvalidateControl methods to force the host application refresh the UI.
Read more about the Ribbon UI (aka Fluent UI) in the following series of articles in MSDN:
Customizing the 2007 Office Fluent Ribbon for Developers (Part 1 of 3)
Customizing the 2007 Office Fluent Ribbon for Developers (Part 2 of 3)
Customizing the 2007 Office Fluent Ribbon for Developers (Part 3 of 3)

Related

How to get built-in controls under particular tabs in excel VSTO c#?

I am working in excel VSTO add-in.
In excel, having built-in tabs, groups, and controls in the ribbon. I need to get the list of built-in controls under the View tab in c#. From that list, I need to set the value of visible/enable property for the controls.
Is there any way to achieve this?
You can't manage built-in controls on the ribbon. The best what you could do is to repurpose built-in controls or build the ribbon from scratch. Read more about repurposing built-in controls in the Temporarily Repurpose Commands on the Office Fluent Ribbon article.
The Fluent UI (aka Ribbon UI) is described in depth in the following series of articles:
Customizing the 2007 Office Fluent Ribbon for Developers (Part 1 of 3)
Customizing the 2007 Office Fluent Ribbon for Developers (Part 2 of 3)
Customizing the 2007 Office Fluent Ribbon for Developers (Part 3 of 3)
See Office 2016 Help Files: Office Fluent User Interface Control Identifiers for ribbon controls IDs.

how can I add custom button to outlook?

how can I add custom button to Outlook send mail form window ?
actually how to achive new mail form window in Application object properties ?
I try NewInspector event with but the event parameter have self inspector but inspector does not have CommandBars object !!
please help
thanks
CommandBars were deprecated. You need to use the Fluent UI for creating a custom UI in Outlook. VSTO provides two main ways for customizing the UI in Outlook:
Walkthrough: Create a custom tab by using Ribbon XML
Walkthrough: Create a custom tab by using the Ribbon Designer
Note, you can design a custom UI using the designer and then export it into an XML markup. See How to: Export a ribbon from the Ribbon Designer to Ribbon XML for more information.
Read more about the Fluent UI (aka Ribbon UI) in the following series of articles:
Customizing the 2007 Office Fluent Ribbon for Developers (Part 1 of 3)
Customizing the 2007 Office Fluent Ribbon for Developers (Part 2 of 3)
Customizing the 2007 Office Fluent Ribbon for Developers (Part 3 of 3)
The only way to add a ribbon button in the current versions of Outlook is through the IRibbonExtensibility interface implemented by your COM addin.
VSTO makes it easier, but the underlying mechanism is still the same.

how to add custom ribbon button on meeting/appointment window in microsoft outlook 2013,2016

need to add ribbon button on highlighted place(button 1 and button 2) in the appointment/meeting screen(see the link for image) of outlook near the Alldayevent checkbox?
Image Link
That area is not customizable, at least not using any public Outlook API.
You can add a custom UI to the ribbon only. The Fluent UI (aka Ribbon UI) is described in depth in the following series of articles:
Customizing the 2007 Office Fluent Ribbon for Developers (Part 1 of 3)
Customizing the 2007 Office Fluent Ribbon for Developers (Part 2 of 3)
Customizing the 2007 Office Fluent Ribbon for Developers (Part 3 of 3)
Also, you may consider creating a form under the ribbon/subject field on your own subclassing Outlook windows. Read more about that on the Creating Adjacent Windows In Outlook page.
FYI Add-in Express provides the TopSubPane layout out of the box which allows placing like shown on the screenshot:

Accessing an existing control on Outlook ribbon

I want to add a CommandBarButton to an existing CommandBarPopup that displays in an Outlook MailItem compose ribbon. (Ribbon ID: Microsoft.Outlook.Mail.Compose)
I found code that shows me how to add a new CommandBarButton to a CommandBarPopup, but I can't find out how to get a reference to the CommandBarPopup. This is an existing Popup on the ribbon, not a custom popup.
Command bars are not used any longer in Office applications (Outlook in your case). Starting from Outlook 2007 the new UI is used instead - Ribbon UI (aka Fluent UI). You can read more about the UI in the following series of articles in MSDN:
Customizing the 2007 Office Fluent Ribbon for Developers (Part 1 of 3)
Customizing the 2007 Office Fluent Ribbon for Developers (Part 2 of 3)
Customizing the 2007 Office Fluent Ribbon for Developers (Part 3 of 3)

Achieve color picker in Office ribbon control

I'm developing my first add in in Sharepoint for office 2013.
I cant find a way to add a color picker without opening a dialogue box.
I want the color picker in the ribbon, like in the MS-Paint.
There is no such control. The Fluent UI (aka Ribbon UI) does provide a limited set of controls that you can use for custom UI in Office add-in. You can read more about the Ribbon UI in the following series of articles in MSDN:
Customizing the 2007 Office Fluent Ribbon for Developers (Part 1 of 3)
Customizing the 2007 Office Fluent Ribbon for Developers (Part 2 of 3)
Customizing the 2007 Office Fluent Ribbon for Developers (Part 3 of 3)
I ended up updating the designer.cs class. adding the required buttons via code in constructor.

Categories

Resources