Dec 03 2021 09:27 AM - edited Dec 04 2021 06:19 AM
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
$ListName = "Tracker" $ViewName = "PrevMonth"
$w = Get-SPWeb https://www.testtest.com/subsite" $l = $w.Lists[$ListName];
$view = $l.Views | ? { $_.Title -eq $ViewName } $viewQuery="11/20/2021"
if($view -ne $null) {
$view.Query = $ViewQuery
$view.Update()
$l.Update()
#Send message to output console write-host "View Updated Successfully!" -foregroundcolor green
}
else {
write-host "Could Not find: " -foregroundcolor red
}
Dec 05 2021 06:34 AM
Solution