Forum Discussion

Ralfh Barten's avatar
Ralfh Barten
Copper Contributor
Feb 21, 2018

Hide modern list Command Bar button

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.

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:

https://docs.microsoft.com/en-us/sharepoint/dev/solution-guidance/modern-experience-customizations-customize-lists-and-libraries

 

5 Replies

  • Anonymous's avatar
    Anonymous

    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.

  • Anonymous's avatar
    Anonymous

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

     

    • Ralfh Barten's avatar
      Ralfh Barten
      Copper Contributor
      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).
  • Anonymous's avatar
    Anonymous

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

Resources