0

My scenario is that I've got a document library that is configured as a custom document set content type. In order to achieve quick adoption of the library for users who don't get into Sharepoint much, I wanted to hide those buttons that could cause problems.

For instance, in this library, the Home Page is a list of all the document sets (e.g. list of projects) and from here the user would click on the title of a project in the list to be taken to the Welcome Page for that set (of documents related to the project). Here they would see the document set/project properties and a list of contained documents.

As the home page represents document sets/projects and not documents – it’s really list items, I want to hide the entire 'Upload Documents' menu item on the ribbon. On the Welcome Page, where it's expected the list contains documents, this menu should be visible.

So far, and with way too much time spent, I was able to come up with the proper CSS ribbon selector syntax to hide that particular button: #Ribbon.Documents.New.AddDocument-Large. I now have an interest in knowing how to do this to a wider selection of ribbon elements, but I'm finding it brutal to figure out what the ribbon id selector syntax should be for any given ribbon element, whether it’s a menu, splitbutton, button, etc. I've looked at the CMDUI.xml file and can see the ribbon ids, and identify what type of object they are, but as in the example, I had no idea that it was supposed to have the "-Large" suffix. So, I'm looking for some rules that tell me how to construct the ribbon id selectors for the various ribbon elements.

I realize there's a time and a place for using CSS instead of a server-side solution, but I'd like to be able to act quickly using CSS or javascript when needed. For javascript, I think the ribbon IDs are sufficient and I wouldn't need to know the specialized CSS selector syntax that starts with the ribbon ID.

1 Answer 1

1

You can find out the selector IDs of any of the Ribbon Elements with Firebug (Firefox) or the Developer Tools (IE and Chrome). Just Press F12 and the developer tools will pop up. You can then select each individual ribbon element and in the HTML see the ID of that element.

Here is a nice example: http://msdn.microsoft.com/en-us/office365trainingcourse_lab_8_1_topic3#_Toc293063864

Also, the "-Large" suffix is present when same images but with different sizes are supposed to be attached to the ribbon button. Generally the ribbon buttons have 2 images each: 32x32 and 16x16. The "-Large" suffix means the image with the 32x32 size is attached to the Ribbon button.

6
  • Hi Vardhaman Deshpande, Thank you for your response. I looked using F12, but I see no references to the ribbon items, but all else was helpful. Jul 22, 2012 at 2:00
  • After you press F12, in the HTML tab, you will be able to see the HTML structure of the page. You will have to select the Mouse Pointer Icon and then click on any of the Ribbon Items. This will take you to that control in the HTML structure. You will be able to see the ID of each ribbon button there. Jul 22, 2012 at 2:52
  • I'm unable to select any of the ribbon items using that technique; I can get to other objects on the page though (and blue box is visible on others to select). Jul 26, 2012 at 3:11
  • Yes this is a problem with IE some times. You won't face this issue in Firefox. Download Firebug for firefox and try with it. It is similar to the Developer tools in IE. addons.mozilla.org/en-us/firefox/addon/firebug Jul 26, 2012 at 6:03
  • I'm sorry for the delay in responding. I downloaded Firefox and Firebug and now I see the id's in the ribbon! Funny how its MS tool and can't see MS elements. I work in MS intranet setting so I'm not inclined to use Firefox but thanks for reminding me to think outside MS. Perfect. Aug 5, 2012 at 17:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.