0

I need some assistance with a task I would like to complete. I want to able to change (correct) the Content Type View settings for all SPWeb in SPSites. I can do this on a per SPWeb basis but would like to all at once.

SP2010 no longer has the ‘group by content type’ option availbale for list views. So to add this functionality back to list/libraries you can use SPDesigner and add the following Query properties directly to the view:

<Query><GroupBy Collapse=”TRUE” GroupLimit=”100″><FieldRef Name=”Content Type”/></GroupBy></Query>

Or, you can use PowerShell, which I have done:

param( [string]$WebURL, [string]$listName )

$web = Get-SPWeb $WebURL;

$list = $web.Lists[$listName];

$view = $list.Views[“By Content Type”];

$view.Query = “<GroupBy Collapse=’TRUE’ GroupLimit=’100′><FieldRef Name=’ContentType’/></GroupBy>”;

$view.Update();

$web.Dispose();


I am still a beginner at PowerShell and need so guidance on how to Loop through all of my SPWeb objects for any given SPSite. I would still like to use my parameters as well. Any help with explanation would be greatly appreciated…

(Visited 90 times, 1 visits today)
Add a Comment