kwizcom banner advertisement

Reset SharePoint List View Filters with PowerShell

Requirement: Reset SharePoint view filters.

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

PowerShell script to reset SharePoint view.
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

$WebURL = "http://sales.crescent.com"
$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>" 
$View.Update()
$List.Update()
This script removes Sorting and Filters applied to the given SharePoint list view.
Reset SharePoint List View Filters with PowerShell Reset SharePoint List View Filters with PowerShell Reviewed by Salaudeen Rajack on April 16, 2015 Rating: 5

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.