Generate Multiple Views on SharePoint Lists or Libraries

Your ads will be inserted here by

Easy Ads.

Please go to the plugin admin page to set up your ad code.

I was having a weird problem with a list we had migrated, and one of the unusal characteristics was that this list had about 50 different views.

To try and replicate the issue with another list, I wanted to create 50 views very quickly.

Your ads will be inserted here by

Easy Ads.

Please go to the plugin admin page to set up your ad code.

Here is how I did it in PowerShell:

$w = Get-SPWeb http://portal.company.com
$l = $w.Lists["Documents"]
$maxViews = 50
 
for ($viewCount=0;$viewCount -lt $maxViews;$viewCount++)
{
	# $null prevents flooding the screen with view information
	# Clone Method Parameters: Name, Row Limit, Paged, Make Default View
	$null = $primaryView.Clone(($primaryView.Title + " " + $viewCount) , 30, $true, $flase)
}

The script worked like a charm in creating the views, however didn’t help me resolve the issue I had with my list.

Your ads will be inserted here by

Easy Ads.

Please go to the plugin admin page to set up your ad code.

Leave a Reply

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