Set a Default View for a document library using Powershell

I have tried to elude myself from Powershell till now (really not sure why). However, finally the trend broke few days back when someone needed my help to do the following and I had o dive in

$site= New-Object Microsoft.SharePoint.SPSite ("http://siteUrl")
$web=$site.OpenWeb()
$list=$web.Lists["MyList"]
$view=$list.Views["MyView"]
$view.DefaultView = $true
$view.Update()
$list.Update()

Related Post

3 thoughts on “Set a Default View for a document library using Powershell”

Leave a Reply

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