PowerShell : Hide SharePoint List via PnP / o365 CLI cmdlet

Creating a SharePoint list for an internal business process doesn’t always mean it should be visible to every end user browsing Site Contents — a supporting list a workflow depends on, for instance, can just cause confusion if someone stumbles onto it. Hiding the list is the fix: it still works normally and is still reachable by URL, it just stops showing up in Site Contents and most list pickers. The same approach is also useful when building out a new list with List Formatting and deliberately delaying when it becomes visible to end users. This post covers doing it with both the CLI for Microsoft 365 and PnP PowerShell.

In this post: CLI for Microsoft 365 · PnP PowerShell · Unhiding it again · Hidden isn’t secured · Referencing a hidden list from Power Automate · Related reading


CLI for Microsoft 365

The tool formerly known as the Office 365 CLI is now the CLI for Microsoft 365, and its command prefix changed from o365 to m365 along with the rename. Log in first with m365 login, then:

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

## get the list, then hide it using its actual Id
$list = m365 spo list get --webUrl $site --title $toHideListName -o json | ConvertFrom-Json
m365 spo list set --webUrl $site --id $list.Id --hidden true

Worth flagging directly: it’s easy to fetch the list into one variable and then reference a differently-named variable on the next line by mistake (a plural $lists that was never actually assigned, referenced as singular $list, for instance) — the script above keeps both lines consistent on purpose, since that specific mismatch is a common copy-paste trap with this exact pattern. If the second command errors with something like “property Id cannot be found,” a variable-name mismatch exactly like that is the first thing worth checking, before assuming the CLI or the list itself is the problem.


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

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

Unhiding it again

Set the hidden value back to false whenever the list should become visible again — --hidden false for the CLI, -Hidden $false for PnP PowerShell. Same commands, same syntax, just the opposite value.


Hidden isn’t secured

Worth being direct about this before treating Hidden $true as an access control: it isn’t one. Hidden only removes the list from Site Contents and most UI pickers — it does nothing to permissions. Anyone who already has access to the site (which, by default, is everyone the list’s permissions are inherited from) can still open the hidden list directly by URL, and it can still surface in SharePoint search results unless separately excluded. “Confusing to stumble onto” and “actually restricted” are two different problems, and hiding only solves the first one.

If a hidden list genuinely needs to be off-limits to most people, not just out of sight, that’s a permissions change — break inheritance and grant access explicitly to only the accounts that need it — layered on top of hiding it, not a substitute for it. And if it shouldn’t show up in search results either, that’s List Settings > Advanced Settings > “Allow items from this list to appear in search results,” set to No — a separate setting from Hidden entirely.

The two settings are genuinely independent, so it’s worth being deliberate about which combination actually fits the goal: hidden-but-searchable suits a supporting list that shouldn’t clutter Site Contents but is still fine to surface if someone’s actively searching for its content; hidden-and-excluded-from-search fits something closer to sensitive, where the intent is closer to “most people should never even know this exists.”


Referencing a hidden list from Power Automate

Hidden lists don’t show up in the standard “List name” dropdown when configuring a SharePoint action in a flow — the dropdown only surfaces lists that are visible in Site Contents. The action still works against a hidden list perfectly fine underneath; it just needs to be told which one directly rather than picked from the list:

  1. In the action’s list-name field, open the dropdown and scroll to the bottom — select Enter custom value instead of picking from the visible list.
  2. Enter the hidden list’s GUID (its Id property) directly into that field, rather than its display name.

Get the GUID from either script above — $list.Id from the CLI example, or (Get-PnPList -Identity $toHideListName).Id from PnP PowerShell if the list is already visible while you’re setting the flow up, before hiding it.


Hidden only removes a list from Site Contents and most pickers — it does nothing to permissions. Anyone with site access can still open it directly by URL.

Worth confirming a list’s current hidden state before assuming it, rather than relying on memory of which lists were hidden and when:

(Get-PnPList -Identity $toHideListName).Hidden

Returns True or False directly — a quick check worth running before troubleshooting “why can’t I find this list,” since a list simply being hidden is a much more common cause than an actual permissions problem.

Worth noting despite the “list” framing throughout this post: a SharePoint document library is, under the hood, its own kind of list — the exact same Hidden property and the same Set-PnPList/m365 spo list set commands work identically against a library, not just a classic list. Nothing here is list-specific; it’s a property every list-type object in SharePoint shares.


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

App Catalog Authentication Automation Backup Compliance Content Type CSS Flows Google Javascript Limitations List Metadata MFA Microsoft Node NodeJs O365 OneDrive Permissions PnP PnPJS Policy PowerApps Power Automate PowerAutomate PowerPlatform PowerShell React ReactJs Rest API Rest Endpoint Security Send an HTTP Request to SharePoint SharePoint SharePoint List SharePoint Modern SharePoint Online SPFX SPO Sync Tags Teams Termstore Versioning

Leave a Comment

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