How to hide site contents or gear icon in sharepoint communication site-UI modern

Gulnar 146 Reputation points
2021-04-21T07:38:46.703+00:00

I gave read access to the users and contribute access for the admins. But I surprised that even the read users can see site contents in the gear icon. How to hide site contents or gear icon in sharepoint communication site (online) for UI Modern page for all users except admins or site owners?
I need explanation for the solution step by step

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

Accepted answer
  1. Echo Du_MSFT 17,316 Reputation points
    2021-04-22T07:21:00.267+00:00

    Hello @Gulnar ,

    According to my research, we could not hide Site contents or Gear icon in SharePoint Online Communication sites like all users except Adminis or Site Owners.

    But you can inject custom CSS through SPFX to hide the gear icon. But this way, regardless of whether you are an Administrator or Site Owner, you will not see the Gear icon.

    Here is a demo: Inject Custom CSS on SharePoint Modern Pages using SPFx Extensions

    CSS code:

    #O365_MainLink_Settings{  
    display:none  
    }  
    

    Thanks,
    Echo Du

    ====================

    If an Answer is helpful, please click "Accept Answer" and upvote it.
    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.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Kausar Shaikh 1 Reputation point
    2022-05-18T15:02:15.903+00:00

    Hello @EcoDu-MSFT Where do we need to inject this custom CSS?
    Thanks,
    KS

    0 comments No comments

Your answer

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