Reset SharePoint List View Filters with PowerShell

Requirement: Reset SharePoint view filters.

Solution: To reset the SharePoint view in bulk, we can use this PowerShell script.

PowerShell script to reset SharePoint view:

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

$WebURL = ""
$ListName = "Proposal Documents"
$ViewName = "All Proposals"  
#Get the Site, List and View objects
$web = Get-SPWeb $WebURL
$List = $Web.Lists[$ListName]
$View = $List.Views | ? {$_.title -eq $ViewName}

#Reset SharePoint View - By default sort by Name
$View.Query = "<OrderBy><FieldRef Name='FileLeafRef' /></OrderBy>" 

This script removes Sorting and Filters applied to the given SharePoint list view.

Salaudeen Rajack

Salaudeen Rajack - SharePoint Expert with Two decades of SharePoint Experience. Love to Share my knowledge and experience with the SharePoint community, through real-time articles!

Leave a Reply

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