0

I have SharePoint online site I need to hide SP ribbon based on user permission. Should not change the master page code.

anyone suggest me to achieve this or creating the new control to inject in all pages.

2
  • I assume just classic pages because you mention master pages? how many pages can you just add a content editor web part to each page with the script loaded? Are you asking how to do it with the script or just how to inject script?
    – Warwick W
    Commented May 29, 2020 at 1:30
  • Is there any OOTB control to hide ribbon for all pages? like, JSON or javascript ribbon controls..etc
    – PGP
    Commented May 29, 2020 at 5:58

1 Answer 1

1

For classic view, you could add custom script link for this requirement.

Connect-PNPOnline -Url https://xxx.sharepoint.com/sites/xxx/
Add-PnPJavaScriptLink -Name "hideNavigationBasedonGroup" -Url /sites/xxx/SiteAssets/yourJShideribbon.js -Sequence 9999 -Scope Site

You could find the script here

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.