In the use of SharePoint, because users often do not want to see the operations that are not frequently used, we often need to customize the ribbon menu, and most of the time it is not hidden, instead, we can hide the ones we don't need. Next, we will take a list as an example to briefly introduce how to partially hide the ribbon menu.
1. By default, the list ribbon menu has two parts: item and list, for example:
2. ribbon menu and List tab of list, which are not required by common users;
3. Create a solution and add a webpart to it to hide the ribbon menu;
You must reference Microsoft. Web. commandui at the following position;
C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.Web.CommandUI.dll
4. Add the attribute ribboncollection to save the hidden ribbon IDs. Separate multiple IDs with semicolons. Then add the hidden menu method, for example:
5. Add our webpart on the page to be hidden, for example:
6. In our webpart settings, add the ribbon ID to be hidden, for example:
7. For details, refer to the ribbon ID. Multiple IDs are separated by semicolons;
8. view the hidden effects, and only the basic operations of the list items are left. The List tab and workflow menus are not available, such:
9. view the ribbon ID. Generally, you can view it in Microsoft documents. You can also view the ribbon ID on the F12 page, for example:
Like ribbon. listitem. Manage. managepermissions-medium, we need to remove the final medium, which only indicates the menu size, and the previous part is the ribbon ID;
Summary
In this example, ribbon is hidden for pages. Therefore, if you want to use webpart for global hiding, you can write user controls and place them in the master page to hide them.