I have a custom masterpage. How can I hide some buttons in the ribbon like:
Open in explorer
and send file
EASY solution is the CSS. Just inspect element from browser and apply some css like
display: none;
If you need this across the site, then add these style into your master page. If you need this for a specific library only, then add these into that specific page using Content Editor Web Part. You can use this plugin in Chrome for generating css.
An an example this selector works for selcting open with explorer. you can use similar method to select other elements
.ms-cui-tabBody li:nth-child(5) .ms-cui-row:nth-child(2){display:none;}
Using id in the selector we can hide the button as follows,
jQuery("Ribbon.Documents.Copies.ManageCopies-Medium").hide();
jQuery("Ribbon.Documents.Copies.SendTo-Medium").hide();
jQuery("Ribbon.Library.Actions.OpenWithExplorer-Medium").hide();
I hided these buttons as follow. I created a feature and an elements.xml. Inside this elements.xml I added:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction Id="RemoveRibbonButton" Location="CommandUI.Ribbon">
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition Location="Ribbon.Documents.Copies" />
</CommandUIDefinitions>
</CommandUIExtension>
</CustomAction>
<CustomAction Id="RemoveRibbonButton" Location="CommandUI.Ribbon">
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition Location="Ribbon.Library.Actions.OpenWithExplorer" />
</CommandUIDefinitions>
</CommandUIExtension>
</CustomAction>
</Elements>