How to hide Buttons from SharePoint List or Libraries using JSON in OOTB Format view

Out-of-the-box SharePoint list and library views come with a command bar full of buttons — New, Upload, Share, Automate, Power Apps — most of which a given audience doesn’t need and shouldn’t necessarily have. JSON command bar formatting lets you hide, rename, or restyle those buttons without any code.


In this post: Applying the JSON format · A working example · Every key you can target · When JSON formatting isn’t enough · When would you actually use this? · Related reading


Applying the JSON format

On the list or library, open the view title dropdown and click Format current view:

Click Advanced mode to edit the JSON directly, rather than working through the limited visual options:

From there, paste in the command bar JSON (see the working example below), hit Preview to confirm it does what you expect before committing, then Save:


A working example

This does three things at once: hides the New command entirely, renames Edit in grid view and gives it primary-button styling, and strips the icon from Share while updating its tooltip:

{
  "commandBarProps" : {
    "commands": [
      {
        "key": "new",
        "hide": true
      },
      {
        "key": "editInGridView",
        "text": "Quick edit",
        "iconName": "EditTable",
        "primary": true
      },
      {
        "key": "share",
        "iconName": "",
        "title": "Share this List"
      }
    ]
  }
}

The primary property is worth understanding since it’s easy to misuse: it only actually applies primary-button styling if the command is also in the 0th position of the command bar — setting primary: true on a button further down the bar has no visible effect on its own.


Every key you can target
'new'
'newFolder'
'newWordDocument'
'newExcelWorkbook'
'newPowerPointPresentation'
'newOneNoteNotebook'
'newFormsForExcel'
'newVisioDrawing'
'upload'
'uploadFile'
'uploadFolder'
'open'
'share'
'copyLink'
'download'
'rename'
'copyTo'
'moveTo'
'delete'
'edit'
'comment'
'editNewMenu'
'powerBI'
'powerBIVisualizeList'
'automate'
'automateCreateRule'
'automateManageRules'
'powerAutomate'
'powerAutomateCreateFlow'
'powerAutomateSeeFlows'
'powerAutomateConfigureFlows'
'aiBuilderCreate'
'aiBuilderGoto'
'aiBuilder'
'alertMe'
'newLink'
'integrate'
'manageAlert'
'powerApps'
'powerAppsCreateApp'
'powerAppsSeeAllApps'
'powerAppsCustomizeForms'
'viewDocumentUnderstandingModels'
'versionHistory'
'openInImmersiveReader'
'classifyAndExtract'
'checkOut'
'checkIn'
'undoCheckOut'
'properties'
'pinItem'
'exportExcel'
'exportCSV'
'export'
'editInGridView'
'exitGridView'
'sync'
'uploadTemplate'
'addTemplate'
'openInOfficeOnline'
'openInOfficeClient'
'addShortcut'
'pinToQuickAccess'
'unpinFromQuickAccess'

The primary-button styling only applies if the command is also in the 0th position of the command bar — setting it on a button further down does nothing visible on its own.

When JSON formatting isn’t enough

JSON command bar formatting only covers what’s in the key list above — it can’t add entirely new logic, react to a user’s specific permission level dynamically, or touch anything outside the command bar itself. For that, the real option is an SPFx Application Customizer extension, which gives full script-level control at the cost of an actual development and deployment process instead of pasting JSON into a view.


When would you actually use this?
  • A list is used by people who shouldn’t be creating new items or deleting existing ones from that view — hide new and delete rather than relying on everyone remembering not to click them.
  • The command bar is cluttered with Power Automate/Power Apps/AI Builder buttons nobody on this list actually uses — stripping them down makes the real actions easier to find.
  • You need to rebrand a button’s label or icon to match how your org actually refers to an action, without touching any code.

Reference: Microsoft Learn: View command bar formatting.



That’s the full picture. Comment below if a specific key doesn’t behave the way you expect.


App Catalog Authentication Automation Backup Compliance Content Type CSS Flows Google Javascript Limitations List Metadata MFA Microsoft Node NodeJs O365 OneDrive Permissions PnP PnPJS Policy PowerApps Power Automate PowerAutomate PowerPlatform PowerShell React ReactJs Rest API Rest Endpoint Security Send an HTTP Request to SharePoint SharePoint SharePoint List SharePoint Modern SharePoint Online SPFX SPO Sync Tags Teams Termstore Versioning

Leave a Comment

Your email address will not be published. Required fields are marked *