December 27, 2012

Powershell - Add newly added field to all views

#Add-PSSnapin Microsoft.SharePoint.PowerShell
$web = Get-SPWeb -Identity "url of web"
#list of views which needs to be changed
$views = @("All Documents","View1","View2")

$list = $web.GetList("ListUrl")
foreach($vwName in $views)
    $vw = $list.Views[$vwName]
    #Add new field
        #position is 0 based
    Write-Host $vwName, "Updated"
If you have any questions you can reach out our SharePoint Consulting team here.

No comments:

Post a Comment