question

Gulnar-6128 avatar image
0 Votes"
Gulnar-6128 asked KausarShaikh-1586 answered

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

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

office-sharepoint-online
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

EchoDu-MSFT avatar image
0 Votes"
EchoDu-MSFT answered EchoDu-MSFT commented

Hello @Gulnar-6128 ,

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
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @Gulnar-6128 ,

Is there anything else I can help with regarding this issue?
You can comment us at any time and we will continue to follow up.

Thanks,
Echo Du

0 Votes 0 ·
KausarShaikh-1586 avatar image
0 Votes"
KausarShaikh-1586 answered

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

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.