Forum Discussion

CubanGuy's avatar
CubanGuy
Copper Contributor
Sep 08, 2022
Solved

Hiding commands using JSON Format doesn't work in web part

I have a document library that I would like to show in the home page of a modern SharePoint site. I added the document library web part to the page, selected the folder I want to show, and selected the view I want to use. In this view I used JSON to hide and move around some of the commands from the command bar:

 

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json",
  "commandBarProps": {
    "commands": [
      {
        "key": "new",
        "hide": false
      },
      {
        "key": "sync",
        "hide": true
      },
      {
        "key": "editInGridView",
        "hide": true
      },
      {
        "key": "download",
        "hide": true
      },
      {
        "key": "automate",
        "sectionType": "Overflow",
        "position": 3
      },
      {
        "key": "manageAlert",
        "sectionType": "Overflow",
        "position": 1,
        "iconName": "AlertSettings",
        "text": "Edit and Manage Alerts"
      },
      {
        "key": "alertMe",
        "sectionType": "Overflow",
        "position": 2,
        "iconName": "WorkItemAlert"
      },
      {
        "key": "export",
        "sectionType": "Overflow",
        "position": 5,
        "iconName": "ExcelDocument"
      },
      {
        "key": "integrate",
        "sectionType": "Overflow",
        "position": 4
      },
      {
        "key": "share",
        "position": 6,
        "sectionType": "Overflow",
        "title": "Share this List"
      }
    ]
  }
}

It works perfectly when I'm in the library itself:

 

But it doesn't when I add this library to a page as a web part:

 

Is it possible to modify which commands to show/hide from a document library when it is a web part in a page?

 

 

  • CubanGuy Unfortunately, document library web part added on site pages does not support all JSON formatting features similar to SharePoint default document library page.


    Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.

2 Replies

  • CubanGuy 

     

    On top of ganeshsanap's input, make sure that you have set correct view in web part where you can configured JSON formatting because row formatting is associated with View

     

     

     

     


    Hope it will helpful to you and if so then Please mark my response as Best Response & Like to help others in this community

  • CubanGuy Unfortunately, document library web part added on site pages does not support all JSON formatting features similar to SharePoint default document library page.


    Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.

Resources