simplifying the sharepoint command bar

added 21st Feb 2025

updated 28th Feb 2025

Introduction

The default SharePoint command bar when viewing a list or library contains really an excessive amount of buttons, most of which are not useful for the general audience. These buttons also change when you select one or more file. For those who aren't familiar with SharePoint, trying to find the right option amongst these when all they want is to create or edit some files can be difficult, especially as some useful actions are hidden in the overflow dropdown.

sharepoint default command bar

These actions also show up in the right-click menu for individual files.

sharepoint default right click menu

Command Bar Customisation

Thankfully SharePoint JSON view formatting allows for customising the command bar to an extent.
https://learn.microsoft.com/en-us/sharepoint/dev/declarative-customization/view-commandbar-formatting

You'll want to be in the Format view section where there's a commandBarProps.command property that accepts an array of command customisation objects. Each object requires the key of the command. There's a number of customisation options available, but the only ones we need to focus on now is the hide option.

sharepoint format view

Available Command Keys

If we look at the given JSON schema, it lists out the various keys (commands) available. However, this list doesn't seem to be up-to-date and there are some additional undocumented keys as you'll see later.
https://developer.microsoft.com/json-schemas/sp/v2/command-bar-formatting.schema.json

Schema Keys

  • 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
  • sync
  • uploadTemplate
  • addTemplate
  • openInOfficeOnline
  • openInOfficeClient
  • addShortcut
  • pinToQuickAccess
  • unpinFromQuickAccess

Hiding Items

When simplifying the command bar, I like to start by hiding all the available options, and then only unhiding the ones that users need. This simplified view gets sets at the default view, and I can always create another view with the default command bar for the odd times I do need to use the other commands.

The following snippet is the JSON required to hide all the command buttons with keys listed in the schema. This also affects the right-click menu for files.

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json",
  "commandBarProps": {
    "commands": [
      {
        "hide": true,
        "key": "new"
      },
      {
        "hide": true,
        "key": "newFolder"
      },
      {
        "hide": true,
        "key": "newWordDocument"
      },
      {
        "hide": true,
        "key": "newExcelWorkbook"
      },
      {
        "hide": true,
        "key": "newPowerPointPresentation"
      },
      {
        "hide": true,
        "key": "newOneNoteNotebook"
      },
      {
        "hide": true,
        "key": "newFormsForExcel"
      },
      {
        "hide": true,
        "key": "newVisioDrawing"
      },
      {
        "hide": true,
        "key": "upload"
      },
      {
        "hide": true,
        "key": "uploadFile"
      },
      {
        "hide": true,
        "key": "uploadFolder"
      },
      {
        "hide": true,
        "key": "open"
      },
      {
        "hide": true,
        "key": "share"
      },
      {
        "hide": true,
        "key": "copyLink"
      },
      {
        "hide": true,
        "key": "download"
      },
      {
        "hide": true,
        "key": "rename"
      },
      {
        "hide": true,
        "key": "copyTo"
      },
      {
        "hide": true,
        "key": "moveTo"
      },
      {
        "hide": true,
        "key": "delete"
      },
      {
        "hide": true,
        "key": "edit"
      },
      {
        "hide": true,
        "key": "comment"
      },
      {
        "hide": true,
        "key": "editNewMenu"
      },
      {
        "hide": true,
        "key": "powerBI"
      },
      {
        "hide": true,
        "key": "powerBIVisualizeList"
      },
      {
        "hide": true,
        "key": "automate"
      },
      {
        "hide": true,
        "key": "automateCreateRule"
      },
      {
        "hide": true,
        "key": "automateManageRules"
      },
      {
        "hide": true,
        "key": "powerAutomate"
      },
      {
        "hide": true,
        "key": "powerAutomateCreateFlow"
      },
      {
        "hide": true,
        "key": "powerAutomateSeeFlows"
      },
      {
        "hide": true,
        "key": "powerAutomateConfigureFlows"
      },
      {
        "hide": true,
        "key": "aiBuilderCreate"
      },
      {
        "hide": true,
        "key": "aiBuilderGoto"
      },
      {
        "hide": true,
        "key": "aiBuilder"
      },
      {
        "hide": true,
        "key": "alertMe"
      },
      {
        "hide": true,
        "key": "newLink"
      },
      {
        "hide": true,
        "key": "integrate"
      },
      {
        "hide": true,
        "key": "manageAlert"
      },
      {
        "hide": true,
        "key": "powerApps"
      },
      {
        "hide": true,
        "key": "powerAppsCreateApp"
      },
      {
        "hide": true,
        "key": "powerAppsSeeAllApps"
      },
      {
        "hide": true,
        "key": "powerAppsCustomizeForms"
      },
      {
        "hide": true,
        "key": "viewDocumentUnderstandingModels"
      },
      {
        "hide": true,
        "key": "versionHistory"
      },
      {
        "hide": true,
        "key": "openInImmersiveReader"
      },
      {
        "hide": true,
        "key": "classifyAndExtract"
      },
      {
        "hide": true,
        "key": "checkOut"
      },
      {
        "hide": true,
        "key": "checkIn"
      },
      {
        "hide": true,
        "key": "undoCheckOut"
      },
      {
        "hide": true,
        "key": "properties"
      },
      {
        "hide": true,
        "key": "pinItem"
      },
      {
        "hide": true,
        "key": "exportExcel"
      },
      {
        "hide": true,
        "key": "exportCSV"
      },
      {
        "hide": true,
        "key": "export"
      },
      {
        "hide": true,
        "key": "editInGridView"
      },
      {
        "hide": true,
        "key": "sync"
      },
      {
        "hide": true,
        "key": "uploadTemplate"
      },
      {
        "hide": true,
        "key": "addTemplate"
      },
      {
        "hide": true,
        "key": "openInOfficeOnline"
      },
      {
        "hide": true,
        "key": "openInOfficeClient"
      },
      {
        "hide": true,
        "key": "addShortcut"
      },
      {
        "hide": true,
        "key": "pinToQuickAccess"
      },
      {
        "hide": true,
        "key": "unpinFromQuickAccess"
      }
    ]
  }
}

If you apply the JSON above though, you'll see that most items in the command bar are removed, but not all. This applies to the command bar both with and without files selected.

sharepoint remaining buttons

Undocumented Command Keys

For the remaining commands, some can still be hidden. If you inspect element on them, you can see that each button has several IDs.

<button
  data-id="createCopilot"
  data-automationid="createCopilotCommand"
  data-actions="[{'key':'cmdbar-itm-click','data':'createCopilot'}]"
></button>

It seems that using data-id as the key in the view JSON works to hide some items. These are case-sensitive.

The following command buttons can show up in different scenarios, such as whether its a SharePoint library or list, if files are selected, and also the type of the selected file.

Known Commands and Their Keys

Command Bar ItemKey
PinToQuickAccessCommandPinToQuickAccessCommand
createCopilotcreateCopilot
addShortcutToOneDriveCommandaddShortcutToOneDriveCommand
syncCommandsyncCommand
UploadCommandUploadCommand
newCompositenewComposite
propertiesCommandpropertiesCommand
stasherContextMenuCommandstasherContextMenuCommand
favoriteCommandfavoriteCommand
pinItemCommandpinItemCommand
previewFileCommandpreviewFileCommand
manageFormsmanageForms
undoundo
redoredo
exitGridViewexitGridView
approveRejectapproveReject
PublishCommandPublishCommand
addToPlaylistCommandaddToPlaylistCommand

Here's an updated JSON with the additional undocumented command keys hidden.

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json",
  "commandBarProps": {
    "commands": [
      {
        "hide": true,
        "key": "new"
      },
      {
        "hide": true,
        "key": "newFolder"
      },
      {
        "hide": true,
        "key": "newWordDocument"
      },
      {
        "hide": true,
        "key": "newExcelWorkbook"
      },
      {
        "hide": true,
        "key": "newPowerPointPresentation"
      },
      {
        "hide": true,
        "key": "newOneNoteNotebook"
      },
      {
        "hide": true,
        "key": "newFormsForExcel"
      },
      {
        "hide": true,
        "key": "newVisioDrawing"
      },
      {
        "hide": true,
        "key": "upload"
      },
      {
        "hide": true,
        "key": "uploadFile"
      },
      {
        "hide": true,
        "key": "uploadFolder"
      },
      {
        "hide": true,
        "key": "open"
      },
      {
        "hide": true,
        "key": "share"
      },
      {
        "hide": true,
        "key": "copyLink"
      },
      {
        "hide": true,
        "key": "download"
      },
      {
        "hide": true,
        "key": "rename"
      },
      {
        "hide": true,
        "key": "copyTo"
      },
      {
        "hide": true,
        "key": "moveTo"
      },
      {
        "hide": true,
        "key": "delete"
      },
      {
        "hide": true,
        "key": "edit"
      },
      {
        "hide": true,
        "key": "comment"
      },
      {
        "hide": true,
        "key": "editNewMenu"
      },
      {
        "hide": true,
        "key": "powerBI"
      },
      {
        "hide": true,
        "key": "powerBIVisualizeList"
      },
      {
        "hide": true,
        "key": "automate"
      },
      {
        "hide": true,
        "key": "automateCreateRule"
      },
      {
        "hide": true,
        "key": "automateManageRules"
      },
      {
        "hide": true,
        "key": "powerAutomate"
      },
      {
        "hide": true,
        "key": "powerAutomateCreateFlow"
      },
      {
        "hide": true,
        "key": "powerAutomateSeeFlows"
      },
      {
        "hide": true,
        "key": "powerAutomateConfigureFlows"
      },
      {
        "hide": true,
        "key": "aiBuilderCreate"
      },
      {
        "hide": true,
        "key": "aiBuilderGoto"
      },
      {
        "hide": true,
        "key": "aiBuilder"
      },
      {
        "hide": true,
        "key": "alertMe"
      },
      {
        "hide": true,
        "key": "newLink"
      },
      {
        "hide": true,
        "key": "integrate"
      },
      {
        "hide": true,
        "key": "manageAlert"
      },
      {
        "hide": true,
        "key": "powerApps"
      },
      {
        "hide": true,
        "key": "powerAppsCreateApp"
      },
      {
        "hide": true,
        "key": "powerAppsSeeAllApps"
      },
      {
        "hide": true,
        "key": "powerAppsCustomizeForms"
      },
      {
        "hide": true,
        "key": "viewDocumentUnderstandingModels"
      },
      {
        "hide": true,
        "key": "versionHistory"
      },
      {
        "hide": true,
        "key": "openInImmersiveReader"
      },
      {
        "hide": true,
        "key": "classifyAndExtract"
      },
      {
        "hide": true,
        "key": "checkOut"
      },
      {
        "hide": true,
        "key": "checkIn"
      },
      {
        "hide": true,
        "key": "undoCheckOut"
      },
      {
        "hide": true,
        "key": "properties"
      },
      {
        "hide": true,
        "key": "pinItem"
      },
      {
        "hide": true,
        "key": "exportExcel"
      },
      {
        "hide": true,
        "key": "exportCSV"
      },
      {
        "hide": true,
        "key": "export"
      },
      {
        "hide": true,
        "key": "editInGridView"
      },
      {
        "hide": true,
        "key": "sync"
      },
      {
        "hide": true,
        "key": "uploadTemplate"
      },
      {
        "hide": true,
        "key": "addTemplate"
      },
      {
        "hide": true,
        "key": "openInOfficeOnline"
      },
      {
        "hide": true,
        "key": "openInOfficeClient"
      },
      {
        "hide": true,
        "key": "addShortcut"
      },
      {
        "hide": true,
        "key": "pinToQuickAccess"
      },
      {
        "hide": true,
        "key": "unpinFromQuickAccess"
      },
      {
        "hide": true,
        "key": "PinToQuickAccessCommand"
      },
      {
        "hide": true,
        "key": "createCopilot"
      },
      {
        "hide": true,
        "key": "addShortcutToOneDriveCommand"
      },
      {
        "hide": true,
        "key": "syncCommand"
      },
      {
        "hide": true,
        "key": "UploadCommand"
      },
      {
        "hide": true,
        "key": "newComposite"
      },
      {
        "hide": true,
        "key": "propertiesCommand"
      },
      {
        "hide": true,
        "key": "stasherContextMenuCommand"
      },
      {
        "hide": true,
        "key": "favoriteCommand"
      },
      {
        "hide": true,
        "key": "pinItemCommand"
      },
      {
        "hide": true,
        "key": "previewFileCommand"
      },
      {
        "hide": true,
        "key": "manageForms"
      },
      {
        "hide": true,
        "key": "undo"
      },
      {
        "hide": true,
        "key": "redo"
      },
      {
        "hide": true,
        "key": "exitGridView"
      },
      {
        "hide": true,
        "key": "approveReject"
      },
      {
        "hide": true,
        "key": "PublishCommand"
      },
      {
        "hide": true,
        "key": "addToPlaylistCommand"
      }
    ]
  }
}

With that JSON applied, you can see it clears the current command bar. Microsoft could always change or add more buttons in the future though.

sharepoint all buttons hidden

From here you can unhide and move around the buttons you actually want to see.

Example Configuration

Here's an example config that I like to use for basic file interactions. It lets users easily create, upload, and check-in/out their documents but hides everything else they don't need.

sharepoint custom command bar sharepoint custom command bar selected
{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json",
  "commandBarProps": {
    "commands": [
      {
        "key": "newComposite",
        "hide": false,
        "sectionType": "Primary",
        "position": 1
      },
      {
        "key": "UploadCommand",
        "hide": false,
        "sectionType": "Primary",
        "position": 2
      },
      {
        "key": "open",
        "hide": false,
        "sectionType": "Primary",
        "position": 3
      },
      {
        "key": "checkOut",
        "hide": false,
        "sectionType": "Primary",
        "position": 4
      },
      {
        "key": "checkIn",
        "hide": false,
        "sectionType": "Primary",
        "position": 4
      },
      {
        "key": "undoCheckOut",
        "hide": false,
        "sectionType": "Primary",
        "position": 5
      },
      {
        "key": "download",
        "hide": false,
        "sectionType": "Primary",
        "position": 6
      },
      {
        "key": "propertiesCommand",
        "hide": false,
        "sectionType": "Primary",
        "position": 7
      },
      {
        "key": "versionHistory",
        "hide": false,
        "sectionType": "Primary",
        "position": 8
      },
      {
        "key": "pinItemCommand",
        "hide": false,
        "sectionType": "Overflow"
      },
      {
        "key": "favoriteCommand",
        "hide": false,
        "sectionType": "Overflow"
      },
      {
        "hide": true,
        "key": "new"
      },
      {
        "hide": true,
        "key": "newFolder"
      },
      {
        "hide": true,
        "key": "newWordDocument"
      },
      {
        "hide": true,
        "key": "newExcelWorkbook"
      },
      {
        "hide": true,
        "key": "newPowerPointPresentation"
      },
      {
        "hide": true,
        "key": "newOneNoteNotebook"
      },
      {
        "hide": true,
        "key": "newFormsForExcel"
      },
      {
        "hide": true,
        "key": "newVisioDrawing"
      },
      {
        "hide": true,
        "key": "upload"
      },
      {
        "hide": true,
        "key": "uploadFile"
      },
      {
        "hide": true,
        "key": "uploadFolder"
      },

      {
        "hide": true,
        "key": "share"
      },
      {
        "hide": true,
        "key": "copyLink"
      },
      {
        "hide": true,
        "key": "rename"
      },
      {
        "hide": true,
        "key": "copyTo"
      },
      {
        "hide": true,
        "key": "moveTo"
      },
      {
        "hide": true,
        "key": "delete"
      },
      {
        "hide": true,
        "key": "edit"
      },
      {
        "hide": true,
        "key": "comment"
      },
      {
        "hide": true,
        "key": "editNewMenu"
      },
      {
        "hide": true,
        "key": "powerBI"
      },
      {
        "hide": true,
        "key": "powerBIVisualizeList"
      },
      {
        "hide": true,
        "key": "automate"
      },
      {
        "hide": true,
        "key": "automateCreateRule"
      },
      {
        "hide": true,
        "key": "automateManageRules"
      },
      {
        "hide": true,
        "key": "powerAutomate"
      },
      {
        "hide": true,
        "key": "powerAutomateCreateFlow"
      },
      {
        "hide": true,
        "key": "powerAutomateSeeFlows"
      },
      {
        "hide": true,
        "key": "powerAutomateConfigureFlows"
      },
      {
        "hide": true,
        "key": "aiBuilderCreate"
      },
      {
        "hide": true,
        "key": "aiBuilderGoto"
      },
      {
        "hide": true,
        "key": "aiBuilder"
      },
      {
        "hide": true,
        "key": "alertMe"
      },
      {
        "hide": true,
        "key": "newLink"
      },
      {
        "hide": true,
        "key": "integrate"
      },
      {
        "hide": true,
        "key": "manageAlert"
      },
      {
        "hide": true,
        "key": "powerApps"
      },
      {
        "hide": true,
        "key": "powerAppsCreateApp"
      },
      {
        "hide": true,
        "key": "powerAppsSeeAllApps"
      },
      {
        "hide": true,
        "key": "powerAppsCustomizeForms"
      },
      {
        "hide": true,
        "key": "viewDocumentUnderstandingModels"
      },
      {
        "hide": true,
        "key": "openInImmersiveReader"
      },
      {
        "hide": true,
        "key": "classifyAndExtract"
      },
      {
        "hide": true,
        "key": "properties"
      },
      {
        "hide": true,
        "key": "pinItem"
      },
      {
        "hide": true,
        "key": "exportExcel"
      },
      {
        "hide": true,
        "key": "exportCSV"
      },
      {
        "hide": true,
        "key": "export"
      },
      {
        "hide": true,
        "key": "editInGridView"
      },
      {
        "hide": true,
        "key": "sync"
      },
      {
        "hide": true,
        "key": "uploadTemplate"
      },
      {
        "hide": true,
        "key": "addTemplate"
      },
      {
        "hide": true,
        "key": "openInOfficeOnline"
      },
      {
        "hide": true,
        "key": "openInOfficeClient"
      },
      {
        "hide": true,
        "key": "addShortcut"
      },
      {
        "hide": true,
        "key": "pinToQuickAccess"
      },
      {
        "hide": true,
        "key": "unpinFromQuickAccess"
      },
      {
        "hide": true,
        "key": "PinToQuickAccessCommand"
      },
      {
        "hide": true,
        "key": "createCopilot"
      },
      {
        "hide": true,
        "key": "addShortcutToOneDriveCommand"
      },
      {
        "hide": true,
        "key": "syncCommand"
      },
      {
        "hide": true,
        "key": "stasherContextMenuCommand"
      },
      {
        "hide": true,
        "key": "manageForms"
      },
      {
        "hide": true,
        "key": "undo"
      },
      {
        "hide": true,
        "key": "redo"
      },
      {
        "hide": true,
        "key": "exitGridView"
      },
      {
        "hide": true,
        "key": "approveReject"
      },
      {
        "hide": true,
        "key": "PublishCommand"
      },
      {
        "hide": true,
        "key": "addToPlaylistCommand"
      }
    ]
  }
}