Thursday, October 12, 2023

Hide SharePoint Lists throughout SharePoint and in the Microsoft Lists App Recent Lists

 With the changes being pushed by Microsoft to open the lists app when opening lists on SharePoint, this can open up an avenue for users to snoop around lists that they have access to that you might not want them to edit directly. Many of these lists are lists used as PowerApp data sources that you have logic to populate said data source and do not want users editing them directly. When users use or navigate to a list in the Lists app and hit the back button, you get presented many lists that you use in these apps and users could become curious and start editing the data source directly. Obviously, your best option is to use dataverse, but not all of us can get funding for those licenses yet so we make due with what we have. 

To solve this issue I have found out you can utilize graph or in my case PowerShell PnP to hide SharePoint lists from anywhere on SharePoint including site contents AND from the lists app recent list. This will almost certainly keep users out of data sources outside of using your apps!  

First thing you will need to configure and Install the SharePoint PowerShell PnP Module once installed, run the following simple script by replacing your $listName with the list you want to hide and the URL to your Site containing the list and your list will instantly become hidden from users. 

$listName = "Test List"

$site = ""

Connect-PnPOnline -Url $site -UseWebLogin
Set-PnPList -Identity $listName -Hidden $true -NoCrawl

It took me some digging to figure this out once I found out users were being redirected to the Lists app and knew I had to find a way to hide these lists I use in apps. Hopefully you will find this useful and or your web searches got you here for the answer! 

Chris Webb

Microsoft MVP

Follow on X @chriswebbtech

No comments:

Post a Comment