Remove actions from the ribbon : SharePoint 2010

When entering text into the Rich HTML Editor with SharePoint 2010, you get a rich ‘ribbon’ experience, with a whole swag of stuff you can do – aptly titled “Format Text”.


This works for the Content Editor WebPart – and HTML content fields, such as Site Column – or Content Type column – like on a Publishing Page for example.

The editor includes a bunch of ‘tab groups’ (font, paragraph, etc) – with individual actions in each – like Bold, Italic, Underline, and so forth.

To *ADD* items to this set, you can use Declarative XML to create a ‘Custom Action’ – see the following for more info on how to do THAT.

How to: Modify the User Interface Using Custom Actions (MSDN)

What if you want to *REMOVE* some actions – or groups ?

And – if you need to drop actions/groups for different page types –  different Master Page and/or Page Layout ?

Well – here is some C# code using the SharePoint API that will allow you to do this.

The basic premise is :

  • Create a Visual Studio project
  • Open a Web UserControl project type
  • Add C# code to hide tabs
  • Include a reference to this user control in the Master Page

Create Visual Studio Project

The (awesome) new Visual Studio 2010 IDE has a bunch of SharePoint related project types – w00t !   More along the lines of the beloved WSPBuilder style – which I still use for SharePoint 2007 development.

  • Open Visual Studio 2010 – and click New > Project
  • Choose the SharePoint 2010 group
  • Pick the top entry “Empty SharePoint project” – give it a name : SPR.Utilities
  • Change the option button to “Deploy as a farm solution” when prompted – and click Finish.

Add a Web User Control

Now we need to add the code for the Ribbon Item Hider – we don’t actually need a ‘feature’ – just need something that will be added to the CONTROLTEMPLATES folder – located inside the 14 Hive – otherwise known as the…. (ahem) … SharePointRoot folder.


  • Right-click on the root project node (in bold) in the Solution Explorer
  • Choose Add > SharePoint Mapped Folder


  • When the Folder picker is shown, expand the TEMPLATE folder
  • Click on CONTROLTEMPLATES – and then OK.

This adds a location that we can add our project code – and the ASCX (web user control). 

We still need a sub-folder – otherwise the code pieces will land in the same folder as the SharePoint OOTB items – over 90 items in that folder !    *eek*

  • Right-click on the CONTROLTEMPLATES folder – and click Add > Folder
  • Change the name of the folder to be SPR.Utilities

Add the web user control

  • Right-click on the SPR.Utilities folder
  • Click Add > New Item
  • Choose the User Control item, from the SharePoint 2010 group
  • Rename it to be RibbonItemHider

Add the code – yay !

This UserControl is to live on a SharePoint Master Page, and thus there will always be a SPContext, and an underlying SPRibbon object available.

We really just need to do the following logic :

  • Grab a reference to the SPRibbon object on the page
  • Trim out the items we DON’T want to show
  • And – um, that’s it !!

Have to add a reference to the following DLL – can paste this path into the dialog shown when you choose “Add Reference”.

C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions14ISAPIMicrosoft.Web.CommandUI.dll

And now the code :

Within the Page_Load event, just add the following code

SPRibbon ribbon = SPRibbon.GetCurrent(this.Page);
if (ribbon != null)


You’ll get some squiggly lines underneath SPRibbon – just do a CTRL+. and choose to add the ‘using’ statement shown :


Obviously – you’ve probably guessed that you don’t just include xxxxxxxxxxxx in the TrimById method.  This will correlate to an entry in the following file :

C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions14TEMPLATEGLOBALXMLCMDUI.XML

  • Open the file in Internet Explorer – it’s pretty big, eh !
  • Do a search for “Ribbon.EditingTools.CPEditTab.Groups
  • The sub-nodes are the ones you’re interested in – a collection of GROUP nodes.
  • The groups should look familiar – they correlate to the panes on the ribbon pane :
              • Ribbon.EditingTools.CPEditTab.EditAndCheckout
              • Ribbon.EditingTools.CPEditTab.Clipboard
              • Ribbon.EditingTools.CPEditTab.Font
              • Ribbon.EditingTools.CPEditTab.Paragraph
              • Ribbon.EditingTools.CPEditTab.Styles
              • Ribbon.EditingTools.CPEditTab.Layout
              • Ribbon.EditingTools.CPEditTab.Markup
  • It follows that you can “TrimById” using these ID’s and the ribbon will be trimmed (!)


AND – to go further than that – you can TRIM off individual buttons – not just the group as a whole. 

Within the GROUP node, is a CONTROLS collection.  If we expand the CPEditTab.Font node – you’ll see each of the buttons as shown on screen.


So – the code to hide the Bold, Underline and Italic buttons – would be :




Easy, eh !?    Well – let’s go put it to use.


Deploy & use the control.

The amazing new SharePoint oriented functionality within Visual Studio has meant that deployment of this control could NOT be easier – I dare you to find an easier way to do it !!!

  • Right-click on the Project node – and click Deploy.
  • Ta-da !   See – I told you it was easy !

Then – we need to reference the control from within the Master Page :

  • Use SharePoint Designer 2010 to open your chosen Master Page
  • Add the following tag at the top of the Master Page

<%@ Register TagPrefix="SPR" TagName="RibbonItemHider" src="~/_controltemplates/SPR.Utilities/RibbonItemHider.ascx" %>


Now – we just need to “use” the tag somewhere in the Master Page.  I added it immediately after the start of the <BODY> tag – pretty sure you could add it anywhere within the HTML body – not in the HEAD section.

<SPR:RibbonItemHider id="RibbonItemHider" runat="server" />

Try it out

When you go back to SharePoint – and change the Master Page to be the one you’ve just edited – you should see that the ribbon has indeed been “trimmed” – cool, eh !?


See – the Bold, Italic and Underline are gone !


In closing

A few hoops to jump through – but you can now trim down other functionality using the same framework – if you’re needing to restrict what editors, authors and so forth are able to do.

Some GOOD uses of this are (for example) :

  • Remove the Edit HTML button – don’t let Content Authors muck with it.
  • Take out the SuperScript and SubScript buttons – and/or Strikeout
  • Remove the Paragraph tab – and then force the visual layout via CSS.

Pretty easy to achieve – and quite easy to narrow down what Content Authors are able to do.

Hope this was of use to you – or at the very least, a little bit ‘interesting’…


23 thoughts on “Remove actions from the ribbon : SharePoint 2010

  1. jyothsna December 8, 2010 / 12:00 pm

    What should I do if i want to remove “More colours” option available in Font colors and background colors?


  2. Chris O'Connor December 13, 2010 / 10:44 pm

    I had a quick look at the “page source” – using the IE Developer Tools – and there is a DIV that you could hide using some CSS.

    >> Ribbon.EditingTools.CPEditTab.Font.FontBackgroundColor.Menu.MsCustom

    You could try using the technique as above (from this post) – or just try via CSS. Please leave a comment if you get it working ! Thanks.


    • jyothsna February 25, 2011 / 12:49 pm

      Hi Chris,
      Thanks alot.It worked with the above method and by using
      for removing morecolors from fontbackground.
      many many thanks…….


  3. Alejandro February 27, 2011 / 11:58 pm

    Hi Very well explained article.
    However in my situation I have some problems with deployment.

    I have a dev enviroment and a prod enviroment.

    So I cant deploy using right click.
    If i create a package and and deploy it and activate through powershell after i add the code to the master page nothing happen.

    i think that this could have something to do to the way i am deploying it.

    Any ideas about this? i am very new to VS 2010


  4. Sanjeev March 31, 2011 / 6:29 am

    Very nice article. Exactly what I have been searching for quite some time.

    I followed each of your steps but even then the Ribbon has not been trimmed. I am very new to SP 2010 & ASP related development.
    The project has been deployed successfully and the GAC contains the SPR.Utilities dll.
    On the Sharepoint site, I did a “View Source” and the SPR.Utilities dll was not present in the source.

    Any pointers on where the problem may be?


  5. pvarady3 May 10, 2011 / 9:06 pm

    Absolutely fantastic work! I’m not a programmer but this worked like a charm! Thanks for the great post!



  6. NavazShaik May 17, 2011 / 10:47 am

    Hi Chris,

    its Very nice article, this will help me alot.



  7. Sayitfast August 4, 2011 / 12:07 am

    Awesome… saved me lots of time!


  8. Sayitfast August 9, 2011 / 1:16 am

    Help.. I can remove certain buttons no problem… but if I remove Fonts or Fontsize the ribbon buttons all become grey in every group.


  9. Falk September 20, 2011 / 8:37 am

    thank’s for this tut
    but this does only local changes. The question ist how do I change this global for all Sites/Pages??


  10. David September 21, 2011 / 6:35 pm

    Great article. I have been scouring the web trying to find an easy way to disable ribbon features when people add a content editor web part to a page and this fits the bill.


  11. Cristina November 24, 2011 / 2:16 pm

    This is the first article i found that actually made it happen! This affects all site when we add it as a controll on the masterpage.

    Thanks for the tutorial and step by step explanation – now i get it 🙂


  12. Sandeep M December 21, 2011 / 11:36 am

    Very very helpful, saved me tons of time.


  13. ZyRaIN February 26, 2012 / 4:56 pm

    I need to hide the unpublish button and delete from both the ribbon and the context menu. Any help would be appreciated 🙂


  14. John Morcos May 22, 2012 / 10:02 am

    That is just great! Thanks 🙂


  15. SH June 12, 2012 / 2:00 pm

    I’m new to SharePoint and you just saved me a lot of time! This is the best step by step instruction on this topic!

    A big thank you!


  16. vincent July 18, 2012 / 3:05 am


    Is this possible to add a button to execute ps script from the server?



  17. imitation hermes bags March 20, 2013 / 5:14 am

    that it may be hard to find a spot in the world where at least two women in the same room are not carrying some version of the luxe louis vuitton hlouis vuitton


  18. Unknown May 6, 2013 / 10:56 pm

    Pretty nice post. I just stumbled upon your weblog and
    wanted to say that I have truly enjoyed browsing your blog posts.
    In any case I will be subscribing to your rss feed and I hope you write again very soon!


  19. June 4, 2013 / 3:05 am

    What i do not realize is in fact how you are no longer really much more
    smartly-appreciated than you might be right now. You are very intelligent.
    You realize therefore significantly when it comes to this
    matter, made me personally believe it from so many various angles.
    Its like men and women are not involved unless it is one thing to accomplish with Woman
    gaga! Your individual stuffs great. Always deal with it up!


  20. extended warranty insurance June 9, 2013 / 2:22 am

    Simply desire to say your article is as amazing. The clearness in
    your post is just spectacular and i could assume
    you are an expert on this subject. Well with your permission let me to grab your feed
    to keep updated with forthcoming post. Thanks a million and please continue
    the rewarding work.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s