The below mentioned codes explains the methods of customizing the ribbon in SharePoint, programmatically.
Hide a Ribbon
- public void HideRibbon()
- {
- SPRibbon spRibbon = SPRibbon.GetCurrent(this.Page);
- if (SPRibbon != null && !this.Page.Request.IsAuthenticated)
- {
- SPRibbon.CommandUIVisible = false;
- }
- }
Hide a Ribbon Group
- SPRibbon spRibbon = SPRibbon.GetCurrent(this.Page);
- if (spRibbon != null)
- {
- spRibbon.TrimById(“RibbonGroupId”);
- }
Hide a single ribbon button
- public void HideRibbonItem()
- {
-
- SPRibbon spRibbon = SPRibbon.GetCurrent(this);
- spRibbon.TrimById("Ribbon.ListItem.New.NewFolder");
- }
-