Hide Buttons from CommandBarProps

Radu TIRNACOP 105 Reputation points
2024-02-06T19:17:05.2066667+00:00

How can I hide the 'Favorite' and 'Add Shortcut' buttons from the commandBarProps? User's image

Microsoft 365 and Office | SharePoint | For business | Windows
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Emily Du-MSFT 51,946 Reputation points Microsoft External Staff
    2024-02-07T07:53:45.0766667+00:00

    1.To remove the "Add shortcut to OneDrive" button in the command bar, you could run following PowerShell as administrator.

    Note: This PowerShell removes the “Add Shortcut to OneDrive” button from all sites in the tenant (Not on a specific site).

    Connect-SPOService "https://tenant-admin.sharepoint.com"
    Set-SPOTenant -DisableAddShortCutsToOneDrive $True
    

    2.JSON codes allow basic changes to the command bar, including modification of icon or text, hiding existing options or repositioning commands.

    But Favorite is not the valid key in the command bar. So, there is no option to remove Favorite button in the command bar.

    Valid keys: https://learn.microsoft.com/en-us/sharepoint/dev/declarative-customization/view-commandbar-formatting#key


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.