Hide modern list Command Bar button

Copper Contributor

Is it currently possible to hide a default Command Bar Button using a CustomAction?

We would like for example to hide the default 'Export to Excel' button.

2018-02-21 13_31_21-App development - Documents - Test View.png

In the Classic view this could be done by a Custom Action:

<CustomAction
        Id="RemoveRibbonButtonLibrary"
        Location="CommandUI.Ribbon"
        RegistrationId="101" 
        RegistrationType="List">>
        <CommandUIExtension>
            <CommandUIDefinitions>
                <CommandUIDefinition Location="Ribbon.Library.Actions.ExportToSpreadsheet" />
            </CommandUIDefinitions>
        </CommandUIExtension>
</CustomAction>

But this doens't work for the Modern button. When we try location 'ClientSideExtension.ListViewCommandSet.CommandBar'. We get error: "The specified properties CommandUIExtension are not supported for client-side custom action".

 

We also cannot found anything related to hiding a button in the documentation:

Customizing "modern" lists and libraries

 

5 Replies

Hi Till now i have not seen a possibility to do that.

Have you tried the css option . In classic by using chrome and locating ribbon element and setting the style to display:none works perfect.

 

Altough that might work, that's not my preferred solution. Still feels like a hack to hide the default button that way.
I have to create a Application Customizer or set a alternate CSS on each site.
Was expecting the same functionality as in the classic ribbon. But looks like that's currently not possible (yet).

@Ralfh Barten 

 

Any chance you've found a way to do this? I'm looking for the same thing, at the moment, and not having any luck with the modern interface.

Same here