Recently I got a query about hiding the New and Upload buttons for a SharePoint library, because there was a need to allow users to browse documents using out-of-the-box SharePoint views in a library while still having permissions to upload files so that they could upload files using an SPFx WebPart or a Canvas App.
This request can easily be achieved using list formatting, by adding customisations to the command bar to hide some buttons as below:
![](https://i0.wp.com/michelcarlo.com/wp-content/uploads/2022/10/buttons-hidden-1024x361.png?resize=838%2C295&ssl=1)
Items to hide/JSON content
Using list formatting, there is an option to hide an out-of-the-box SharePoint button from the command bar in a view (for both lists and libraries).
To hide the New and Upload buttons from a view, you can simply use the below JSON, by mentioning the command key, and the property ‘hide‘ as true:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json",
"commandBarProps": {
"commands": [
{
"key": "new",
"hide": true
...
Source link
More About This Author
![michelcarlo](https://i0.wp.com/365community.online/wp-content/uploads/2020/04/C6zQCIg6_400x400.jpg?resize=150%2C150&ssl=1)
-
SharePoint and Office 365 Consultant/Developer always trying to get the best from Microsoft stack (Microsoft 365/Azure/Power Platform and related stuff).
Living in Ireland since 2018, I had previously worked in Brazil as a consultant/developer for Office 365, SharePoint and related technologies for almost 10 years.
Array
Modern Workplace24 July 2024Power Pages Table Permissions: Configure permissions to see records from child Accounts
Modern Workplace15 July 2024Copy Dataverse contact phone numbers across different environments based on Contact e-mail address using Power Automate
Modern Workplace1 June 2024Get the current logged Power Pages user Contact ID via JavaScript and use it to create records assigned to the current user
Modern Workplace11 May 2024How to get the current Azure Devops iteration name for a project using Power Automate