Forum Discussion
Add custom action with add-pnpcustomaction
Hi MarcoMangianteIM,
You can hide actions in command bar in modern experience using View formatting. More information about this can be found https://learn.microsoft.com/en-us/sharepoint/dev/declarative-customization/view-formatting and https://learn.microsoft.com/en-us/sharepoint/dev/declarative-customization/view-commandbar-formatting.
To hide the Delete button from the commandbar, the view formatting code should be as follows:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/tile-formatting.schema.json",
"commandBarProps": {
"commands": [
{
"key": "delete",
"hide": true
}
]
}
}
Note: this is hiding the delete button from command bar, but still will be shown in the file/item context menu. If needed to be removed completely, I would prefer then controlling this using permissions by creating a new https://sharepointmaven.com/how-to-create-a-custom-permission-level-in-sharepoint/, i.e., to allow users to create, and edit items, but not to delete items.