I have a documents library named “Shared Documents” in which I want to set “Show all items without folders” property for “All Documents” list view.
You can download setup files from the releases section of the PnP PowerShell repository.
Copy the below script and paste it in a notepad. Save the file as SetListView.ps1.
- # Input Parameters
- $siteURL="https://c986.sharepoint.com/sites/dev"
- $listName="Shared Documents"
- $viewName="All Documents"
- # Connect to SharePoint Online site
- Connect-PnPOnline –Url $siteURL –Credentials (Get-Credential)
- # ViewScope Enum
- $viewScope=[Microsoft.SharePoint.Client.ViewScope]::Recursive
- # Update the list view
- Set-PnPView -List $listName -Identity $viewName -Values @{Scope=$viewScope}
ViewScope enum:
- >cd "<folderlocation>"
folderlocation – SetListView.ps1 file location
Run the following command
- >.\SetListView.ps1
Reference: Set-PnPView
Thus in this blog, you saw how to set the list view scope in SharePoint Online using PnP PowerShell.

Viknaraj ManogararajahPosted Jul 19, 2018, 6:31 AM
Nice Article...........
Hadshana KamalanathanPosted Jul 16, 2018, 8:20 PM
Thank you for sharing