← Back to overview
March 10, 2011 · Ribbon SharePoint 2010

SharePoint 2010 Ribbon customizations not working as expected

Customizing the SharePoint 2010 isn’t a walk in the park. Working with the XML files using CustomActions, CommandUIExtensions, CommandUIDefinitions, … can get a little annoying after a while, especially if you’re re-deploying your feature after each change.

While customizing the ribbon today I encountered a very frustrating problem with the ribbon customizations. For each change I made in the Elements.xml and deployed to SharePoint it was as if I didn’t change a thing. After numerous attempts I even decided to throw away my customizations and use some I found on the web (from Chris O’Brien) for example.

Even this didn’t help and this is where I got suspicious of my environment. As I was using the following code I thought it could have something to do with my issues:

SPRibbon ribbon = SPRibbon.GetCurrent(this.Page);  
ribbon.MakeTabAvailable("Sandrino.Ribbon.Tab");  

Before the next deployment I changed the ID of the tab (both in the Elements.xml and the MakeTabAvailable method) and there it did work. So it seemed only the first deployment for that tab ID worked correctly.

After a long search it seemed the reason was that I didn’t update the feature version. Feat ure version didn’t exist in SharePoint 2007 but this is a new concept in SharePoint 2010. Jeremy Thake has a great webcast that explains the "why and how" of feature versioning in a webcast.

So finally, to get the ribbon to work correctly after changing something you need to update the version of your feature. This is easy to do in Visual Studio 2010, just open the feature and go to the properties window.

Voila. Redeploy the feature and this time you will see your changes!

In the end this has something to do with how the customizations are cached and how your browser picks them up. When you’re in the process of customizing the Ribbon and you don’t want to change the version each time you want to test something, just try the following:

By right clicking the IE icon you can start InPrivate browsing, which starts a clean IE instance without cookies, cache, … And this will also make sure you get the latest ribbon version while you’re testing.

Enjoy…

  • LinkedIn
  • Tumblr
  • Reddit
  • Google+
  • Pinterest
  • Pocket
Comments powered by Disqus