PowerShell : Hide SharePoint List via PnP / o365 CLI cmdlet


Overview


The creation of a SharePoint list may occasionally be necessary when developing internal business procedures for organisations. For the end user, who sees the list there, it might occasionally cause confusion. Therefore, we may prevent this by removing the list from the SharePoint site. The list will function normally and have a URL for access. When using List Formatting to create a new list while delaying its availability, this situation can also be employed. A few steps in SharePoint may be used to accomplish this. The Office 365 CLI and PNP PowerShell will be used as examples.


Office 365 CLI Cmdlet

##initialize needed variables
$toHideListName = "MyListName"
$site = "https://mysharepointtenant.sharepoint.com/"

##Connect to your site via o365 cmdlet login
$lists = o365 spo list get --webUrl $site -t $toHideListName -o json| ConvertFrom-Json
o365 spo list set --webUrl $site -i $list.Id -t $toHideListName --hidden true 

PnP PowerShell Cmdlet

##initialize needed variables
$toHideListName = "MyListName"
$site = "https://mysharepointtenant.sharepoint.com/"

##Connect to your SharePoint site with PnP cmdlet
Connect-PnPOnline -Url $site -UseWebLogin
Set-PnPList -Identity $toHideListName -Hidden $true

Simply set the value of hidden to false if you want the list to return to being Visible. If you use Power Automate app, these hidden lists won’t show up in the dropdown; however, if you use a custom property and add the name there, it will work.


Now that’s another tip! Hope it helps somehow. Let me know if you have questions or just leave a comment if we missed something.

Happy SharePointing! #SharingIsCaring


Accounting.js Automation Collaboration Competitors Connect Content Type Design Expand Flows Hillbilly Tabs Issues Javascript Limitation Limitations Microsoft Teams ModernScriptEditor NodeJs Node Versioning Numeral.js O365 Office 365 OneDrive Out Of The Box PnP Power Automate PowerShell Pwermissions Rest Endpoint ScriptEditor Send an HTTP Request to SharePoint SharePoint SharePoint Architecture SharePoint Designs SharePoint Modern SharePoint Online SharePoint Tabs ShellScript SPFX SPO Sync Teams Transform JS TypeScript Versioning Workflows

Leave a Comment

Your email address will not be published. Required fields are marked *