Is it possible to also customize command bars in web parts same as for list views?
-
Hi @sp00ky, did you try below solution? Is it working for you?Ganesh Sanap - MVP– Ganesh Sanap - MVP2023-03-02 07:06:15 +00:00Commented Mar 2, 2023 at 7:06
-
Hi @ganesh, as said this is clear, but not what I meant. See my commet belowsp00ky– sp00ky2023-03-02 07:08:23 +00:00Commented Mar 2, 2023 at 7:08
-
Check updated answer below. Hope if helps!Ganesh Sanap - MVP– Ganesh Sanap - MVP2023-03-02 07:19:12 +00:00Commented Mar 2, 2023 at 7:19
-
Hi @sp00ky, does below updated response answers your question? If yes, Please Upvote(^) and accept as an Answer as it helped you & it will help others with similar question in future to find the correct answer easily.Ganesh Sanap - MVP– Ganesh Sanap - MVP2023-03-31 11:40:47 +00:00Commented Mar 31, 2023 at 11:40
1 Answer
I just tried using below JSON in SharePoint list view formatting for command bar:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json",
"commandBarProps": {
"commands": [
{
"key": "new",
"hide": true
}
]
}
}
It works both in SharePoint list view as well as in list web part on SharePoint site page.
SharePoint list view:
List web part on page:
Update from comments:
Unfortunately, you cannot customize site page command bar using JSON command bar formatting. There are no SharePoint default functionalities available to customize these commands.
You might be able to hide few of the options from page command bar. Check my answer at: SharePoint Modern Page - Hide Edit , Analytics , Page details options
-
This is clear, that the menu of the list can be also changed with view formatting feature inside of the webpart. But I want to hide the menu of the page/webpart. e.g. page details, analytics and so on.sp00ky– sp00ky2023-03-02 07:06:33 +00:00Commented Mar 2, 2023 at 7:06
-
Unfortunately, you cannot customize site page command bar using JSON command bar formatting. See updated answer for possible workaround.Ganesh Sanap - MVP– Ganesh Sanap - MVP2023-03-02 07:17:04 +00:00Commented Mar 2, 2023 at 7:17


