Last active
September 18, 2015 11:02
-
-
Save Na0mir/cdc9c2aefe277a96a701 to your computer and use it in GitHub Desktop.
Edit all views in a single site collection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ---------------------------------------------- | |
# Author: Romain Blanchard | |
# Date: 11.08.2015 | |
# Description: Edit all views in a single site collection | |
# ---------------------------------------------- | |
Add-PSSnapin Microsoft.SharePoint.Powershell | |
$SiteUrl = "http://mycpdintg.intg2013.dpgp.emea.loreal.intra/sites/ipanel" | |
$ViewName = "Published Folders" | |
$site = Get-SPSite $SiteUrl | |
foreach ($web in $site.AllWebs) | |
{ | |
for($i=0;$i -lt $web.Lists.Count;$i++) | |
{ | |
$views = $web.Lists[$i].Views | Where {$_.Title -eq $ViewName} | |
foreach ($view in $views) | |
{ | |
$view.Query = $view.Query.Replace('$Resources:MyCPDResources,FIELDS_iPanelAlertsIsReady_ValueReady;','Published') | |
$view.Update() | |
} | |
} | |
} | |
Write-Host "Done !" -ForegroundColor Yellow |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment