Forum Discussion
SharePoint Online hide "site contents" and "site usage" page (modern sites)
phil333 Thanks, no I just assumed that's what you were using, we are using modern sites so this is perfect. We will try this.
Best,
Paul.
- KrishanGApr 05, 2022Copper Contributor
Hi phil333 and others,
I too found this thread quite relevant and useful even in 2022. That means Microsoft isn't coming forward to allow advance customization and such communities will have a rescue.
The problem with the extension is that it is making the site "Not secure" for people with edit permissions. Is it supposed to be the case or am I missing anything in the process?
Regards,
Krishan - PaulMSMay 28, 2021Copper ContributorThank you Rob, yeah those wiki libraries are kind of useless and don't even provide basic functionality like a table on contents. This pretty much seals my fate and using regular site pages seems like the only solution. I did manage to find an app developer that is creating a solution to be able to copy and paste an entire word document into a site page including images in one web part and are working on adding the table on contents feature as well.
Best,
Paul. - RobElliottMay 28, 2021Silver Contributor
I don't have a solution to this I'm afraid, but as former owner of a wiki development company I'm still surprised that anybody uses Microsoft's wiki in SharePoint. It was rubbish when it was released all those years ago and never got better because they never put any effort into developing it. At my company we now just use ordinary site pages for collaboration and knowlegebases.
Rob
Los Gallardos - PaulMSMay 28, 2021Copper Contributorphil333, so we ran into another challenge with this. We have set up a wiki library for wiki pages as a knowledge base for our users. We have managed to hide the gear icon from the entire site including the main page of the wiki library but now when a visitor goes into a wiki page, that pesky gear icon is showing again and allows users to see shared with and site contents. Has anyone else run into this issue and resolved it? We are using a Communication Site template. Thanks in advance for any ideas.
- RamizDec 12, 2020Copper Contributor
phil333
I am using modern SharePoint and user is limited as well. I am attaching a video for your reference that whats the issue I am facing. I have alert and Dialog messages in my extension. You will see when I am navigating the extension code doesn't trigger but after refreshing the page it works. Thats my problem. Have a look at it.https://www.loom.com/share/581c758aff6c4d23879dc36d4758bbda
Also for your referencing there was something on https://www.eliostruyf.com/things-to-check-in-your-spfx-application-customizer-after-page-transitions/ blogs about the page transition and issue in spfx extension while navigating. I tried this as well but no luck so far.
- phil333Dec 10, 2020Brass Contributor
Ill do best to try. So you say your trying to hide the recycle bin right? And much like the site contents gear, it loads after the page does?
You could try putting a console log before what ever code you have to execute. That way it will at least let you know its running.
Also this may be redundant, but the code I provided only runs based off permission. Are you testing this with an un-elevated account?
- RamizDec 10, 2020Copper Contributor
phil333
I am using sharepoint online modern experience. My issue is in navigation. When I navigate though list or library the extension doesnt work but on refreshing the page it works. I am checking other blogs as well about rendering and architect of sharepoint that how it loads the page partially. I am still not able to solve this issue. Can u help me in that? - RamizDec 02, 2020Copper Contributor
Hi phil333 ,
I managed to build the extension as well and is working fine. After that I tried to hide the recycle bin as well from certain users. I did the code like this.public onInit(): Promise<void> { Log.info(LOG_SOURCE, `Initialized ${strings.Title}`); const canEdit = this.context.pageContext.web.permissions.hasAnyPermissions(SPPermission.manageWeb); if(!canEdit) { alert('s'); let checkExist = setInterval(()=> { const setting = document.querySelector("#O365_MainLink_Settings_container").firstChild.firstChild.firstChild.firstChild; if(typeof(setting) != "undefined" && setting != null) { setting.parentElement.parentElement.parentElement.remove(); console.log("User only has view rights."); clearInterval(checkExist); } }, 100); let checkExist2 = setInterval(()=> { const recycle = document.querySelectorAll("a.ms-Nav-link"); var str = "Recycle bin"; var pos = 0; var i = 0; for(i = 0; i < recycle.length; i++ ) { pos = recycle[i].innerHTML.indexOf(str); if(pos > -1) { if(typeof(recycle) != "undefined" && recycle != null) { recycle[i].parentElement.remove(); console.log("User only has view rights."); clearInterval(checkExist2); } } } }, 100); } return Promise.resolve(); }The code work when I open my website but when I go to a list or navigate, it doesnt work. My assumption is it might need some other trigger rather than onInit. Do we have any other functions that we can use or Am I doing something wrong?
- phil333Dec 02, 2020Brass Contributor
So this is just an alert being called in your code somewhere. Its an easy fix. Open up your extension and search for the phrase "Hello from".
It should look something like this maybe:
alert("Hello from "+someVarName);It should be on the page you added the javascript to so you could hide the gear.
If your still having issues show me a screen shot of of your code and I can point it out to you.
- phil333Dec 02, 2020Brass ContributorHey thank you.
Could you show me what you mean? Like a screen shot maybe? Im sure something can be done. - PaulMSDec 01, 2020Copper Contributor
phil333 Hi again, your info helped a lot, we managed to develop the extension and deploy it on our site. We're wondering if you know how to remove the pesky extension pop-up window that always shows up now when you access certain pages on the site? Any info on this would be greatly appreciated!
Thanks again,
Paul.