Posts

Showing posts with the label Hide Ribbon buttons

Hide buttons control from ribbon for specific list

Image
Hi , I want to hide "New Folder" button from ribbon of my library "Shared Documents" for site "SP2010-01".     To hide this button from ribbon for a Shared Documents, You must write this code : using (SPSite site = new SPSite("http://SP2010-01")) { using (SPWeb web = site.OpenWeb()) { SPList list = web.Lists.TryGetList("Shared Documents"); web.AllowUnsafeUpdates = true; SPUserCustomAction actionView = list.UserCustomActions.Add(); StringBuilder newurl = new StringBuilder(); newurl.AppendLine("<CommandUIExtension>"); newurl.AppendLine("     <CommandUIDefinitions>"); //Provide Location ID to hide the button newurl.AppendLine("        <CommandUIDefinition Location=\" Ribbon.Documents.New.NewFolder \">"); newurl.AppendLine("        </CommandUIDefinition>"); newurl.AppendLine("    </CommandUIDefinitions>");...