Globals.Ribbons empty when starting Outlook addin?

I am creating a plugin for Outlook 2010 using VSTO 2010 and .NET 4. I use the XML method to create the feed because I need context menus. Unfortunately, although the feed is created before the Startup event handler is activated, I cannot access the feed using Globals.Ribbons.MyRibbonin the handler! I added the following to my Ribbon.cs code:

partial class ThisRibbonCollection : Microsoft.Office.Tools.Ribbon.RibbonReadOnlyCollection
{
  internal MyRibbon MyRibbon
  {
    get { return this.GetRibbon<MyRibbon>(); }
  }
}

But it seems that RibbonReadOnlyCollection is empty when I try to access it from the trigger event handler.

On the other hand, if I use the constructor, I can access the collection without problems. How to add a new tape to the collection? I do not see any given methods or any instance of the feed collection that can be customized.

+3
2

, XML, Globals.Ribbons. . .

+1

ThisAddIn

public Ribbon myRibbon;
protected override Microsoft.Office.Core.IRibbonExtensibility CreateRibbonExtensibilityObject()
            {
                Ribbon appointmentRibbon = new Ribbon();
                myRibbon = appointmentRibbon;  // save to local variable

                IRibbonExtensibility ribbonExtensibility = appointmentRibbon;
                return ribbonExtensibility;
            }
0

Source: https://habr.com/ru/post/1758038/


All Articles