Monday, October 18, 2010

SharePoint 2010 Modifying UI Version in PowerShell

To change UI version of a SharePoint 2010 site between 2007 and 2010 you can use the following PowerShell code:

$site = Get-SPSite -identity http://{site url}

To 2007 mode:

$site | Get-SPWeb -limit all | ForEach-Object { $_.UIversion = 3; $_.UIVersionConfigurationEnabled = $false; $_.update(); }

To 2010 mode:

$site | Get-SPWeb -limit all | ForEach-Object { $_.UIversion = 4; $_.UIVersionConfigurationEnabled = $false; $_.update(); }

Wednesday, October 6, 2010

PowerShell - Stopping the annoying confirm messages

To stop those annoying confirm messages (i.e. "Are you sure you want to perform this action?") , do this:

$ConfirmPreference = "None"


the end

Looping through all SharePoint 2010 sites with PowerShell

Just needed to loop through all SPS2010 sites and disable and enable a feature. The following PowerShell script does this. (this outputs the site url so I can observe the progress)


$site = Get-SPSite -identity http://{siteurl}


$site | Get-SPWeb -limit all | ForEach-Object { Write-Host $_.Url; Disable-SPFeature -Identity {featureid} -url $_.Url; Enable-SPFeature -Identity {featureid} -url $_.Url }

Friday, October 1, 2010

SharePoint 2010: One or more field types are not installed properly

We started migrating our old SharePoint 2007 sites to SharePoint 2010. It all has been going pretty smoothly, until we found a pesky little problem when creating new subsites:

"One or more field types are not installed properly. Go to the list settings page to delete these fields."

Not much more detail in the ULS logs to describe which field is not installed properly. After some Googling and experimentation the problem was determined to be the changes between SharePoint 2007 and 2010 in the "Relationship List" (http://{siteurl}/Relationships%20List/AllItems.aspx).

Basically to fix the problem, you need to deactivate the SharePoint Server Publishing Infrastructure feature, delete the relationship list and reactivate the SharePoint Server Publishing Infrastructure feature.

The following PowerShell is all you need:

Disable-SPFeature -Identity F6924D36-2FA8-4f0b-B16D-06B7250180FA -Url http://{siteurl}


$site = Get-SPSite -Identity http://{siteurl}

$site.RootWeb.GetList("Relationships List").Delete()


Enable-SPFeature -Identity F6924D36-2FA8-4f0b-B16D-06B7250180FA -Url http://{siteurl}