2

I know there are similar questions on the Internet. But none of it have the solution that I am looking for. I want to hide few action buttons (New, Edit in Grid View, Add shortcut to OneDrive, Pin to Quick Access, Share, etc.) in SharePoint Command bar using SPFX extensions. enter image description here

I know it can be achieved by injecting custom CSS with display: none property. But the problem is, in case in future if Microsoft updates the html element then this solution might break.

Another approach is to use JSON Formatting. But this needs to be done from SharePoint UI or by calling the SharePoint API to apply the JSON formatting. But I don't want to do this.

Initially my approach was: Access the command button like

const newCommand: Command = this.tryGetCommand("newComposite");
newCommand.visible = false

But I am getting undefined when I access it.

Is there any way to hide the command buttons from the code itself using SPFX extension.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.