SHAREPOINT2010 list default View Update 1, Introduction
It's convenient to manage SharePoint projects with a cmdlet script, but it's a lot of effort to write to me with less contact with scripting languages. The requirements are managed by the SharePoint development Portal, where the customer asks for a document with a default view of 15 articles per page, and a picture library showing 12 per page. Because there are many sites, subsites, and libraries created. If one changes that very easy to miss to touch a library, and maybe another day and mood is not happy to change the number of bars displayed per page. So write a script and run and solve the problem.
2. Instruction Set Explanation
Here's a simple order for some instructions.
foreach-object{} loops through each item in the preceding collection.
where-object{}; Filters the previous collection, returning the same set
3. Scripts written by yourself
Update document library default view display 15 article
$sites =get-spsite;
$sites | foreach-object{
$webs =$_. Allwebs;
$webs | foreach-object{
$lists =$_. Lists;
$lists = $lists | Where-object{$_. Basetemplate-eq "DocumentLibrary"};
$lists | foreach-object{
$v =$_. DefaultView;
$v. rowlimit=15;
$v. Update ();
Write-host$v.rowlimit;
}
}
}
Update the picture library, the default view shows 12 articles
$sites =get-spsite;
$sites | foreach-object{
$webs =$_. Allwebs;
$webs | foreach-object{
$lists =$_. Lists;
$lists = $lists | Where-object{$_. Basetemplate-eq "Picturelibrary"};
$lists | foreach-object{
$l
$v =$_. DefaultView;
$v. rowlimit=12;
$v. Update ();
Write-host$v.rowlimit;
}
}
}
Summarize:
Nearly 1 months have not written a blog, in one months have been busy SharePoint projects, self-feeling actually more things to see, SharePoint is only a wide range of knowledge is not difficult.
SHAREPOINT2010 List default View update