How to Position a custom Ribbon Group

Add-in Express™ Support Service
That's what is more important than anything else

How to Position a custom Ribbon Group
Problem positioning a new custom Ribbon Group to the RIGHT of the Old Custom Ribbon Group 
German Hayles




Posts: 30
Joined: 2015-04-27
We have two custom Ribbon Groups. Both are working just fine without a problem.

The Business would like that the New group appear behind (To the Right) of the old Ribbon Group.

I'm using the InsertAfterId in the New Group. I'm giving it the value of the Old Group Id.


Other Details (NOTE: This is for Outlook 2013/2016)


  • OLDGROUP Add-In has loads of initialization to perform and even pops up a modal dialog box to log into a local database before you're allowed to proceed to use Outlook.
  • OLDGROUP Add-In's Visibility can be Toggled off and on
  • NEWGROUP Add-In is very light weight. It doesn't have to interact with any other system on startup like OLDGROUP.



Is what I'm attempting possible or even advisable?
Posted 23 Apr, 2017 23:24:10 Top
Andrei Smolin


Add-in Express team


Posts: 14106
Joined: 2006-05-11
Hello German,

In my test add-in that creates two Ribbon groups on the same tab, swapping the groups in the Ribbon designer window also swaps them in the UI. Is this what you are looking for?

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 26 Apr, 2017 07:59:04 Top
German Hayles




Posts: 30
Joined: 2015-04-27
Yes, I'd like to swap them.

This one is kind of challenging.

One group may not always be loaded, or Visible. The other group hopefully won't throw exceptions because the Id in the InsertAfterId may not be valid if the other control is not visilbe, or temporarily disabled.

By the way I THINK, only the newer group will need to use the InsertAfterId value, since it's ITS position that we want to change.
Posted 26 Apr, 2017 12:39:47 Top
Andrei Smolin


Add-in Express team


Posts: 14106
Joined: 2006-05-11
Hello German,

In the Ribbon tab designer position them in the order required (without using BeforeId or AfterId properties); just drag a group to a required location.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 27 Apr, 2017 02:20:24 Top
German Hayles




Posts: 30
Joined: 2015-04-27
I'm sorry, I left out the fact that these two groups are coming from different Add-Ins altogether.
Posted 28 Apr, 2017 10:44:08 Top
Andrei Smolin


Add-in Express team


Posts: 14106
Joined: 2006-05-11
Hello German,

Please download two add-in projects that share the same ribbon tab; the second add-in's group is always displayed before the first add-in's group (I suggest that you check this by disabling and enabling the add-ins):

http://temp.add-in-express.com/support/SharedRibbonTabPositionedGroupsAddin1.zip
http://temp.add-in-express.com/support/SharedRibbonTabPositionedGroupsAddin2.zip

In the settings of the groups pay special attention to the values of these properties:

Id
InsertAfterId
InsertBeforeId
Shared

Please find more details about the Shared property in section Sharing Ribbon controls across multiple add-ins at https://www.add-in-express.com/docs/net-ribbon-components.php#sharing-ribbon-controls. Also, you can use Clipboard.SetText(e.Xml) to study the Ribbon XML that Add-in Express generates.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 01 May, 2017 07:06:44 Top
German Hayles




Posts: 30
Joined: 2015-04-27
Sorry, for the late response. I'll get to this today and get back to you ASAP.
Posted 02 May, 2017 10:25:46 Top
Andrei Smolin


Add-in Express team


Posts: 14106
Joined: 2006-05-11
No problem at all!

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 02 May, 2017 10:26:52 Top
German Hayles




Posts: 30
Joined: 2015-04-27
[img]file:///c:/Users/haylge/Pictures/2017-05-04_17-42-38.png[/img]

[img]file:///c:/Users/haylge/Pictures/2017-05-04_16-55-08.png[/img]

I'm sure I did something wrong.

On my machine:

ADD-IN1: This is a VSTO Add-In. NOT Created with Add-In-Express
ADD-IN2: This was created using Add-In Express.

I added the "shared" name space to the Ribbon XML in the VSTO Add-In. I'm not sure what I'm missing.

<?xml version="1.0" encoding="UTF-8"?>
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load"
          xmlns:shared="OrchDev">
Posted 04 May, 2017 17:06:25 Top
German Hayles




Posts: 30
Joined: 2015-04-27
I'm not sure if the images are showing.

One is an error screen that says that the "shared" name space was not declared.

The other image shows the values I set



InsertAfterId = shared:orcSend ("orcSend" is the name of the Custom group from the VSTO Add-In)
Shared = True
Posted 04 May, 2017 17:10:02 Top