Visual Upgrade or Downgrade of SharePoint 2010 Site

By James|08/15/2011|,

While you can perform a Visual Upgrade on a SharePoint 2007 site after importing it into SharePoint 2010, what if you want to change it back?

The SharePoint 2007/2010 visual style is determined by the site's UIVersion property. A value of 3 dictates a 2007 look and feel, while a value of 4 dictates a 2010 appearance.

We can use PowerShell to change the UIVersion at will.  The following script will recursively upgrade or downgrade a site's visual style.

# Title Set-SPWebUIVersion
# Version 1.1 25JAN12
# Author James Sanders
# Purpose Perform a Visual Upgrade/Downgrade of SharePoint 2010 web site and subsites

Param([string]$URL, [string]$Style)

# Internal script functions
Function ShowHelp() {
$HelpText =@"

SP2010SiteStyle
Perform a "Visual Upgrade/Downgrade" of SharePoint 2010 web site

PARAMETERS
-url [REQUIRED] URL of site to change
-style [REQUIRED] (2007|2010) Which UI version to apply

EXAMPLES

Changes site to 2007 style
Set-SPWebUIVersion.ps1 -url http://web_to_change -style 2007

Changes site to 2010 style
Set-SPWebUIVersion.ps1 -url http://web_to_change -style 2010

"@
$HelpText
}

# Enumerate SharePoint web site to include all subwebs
Function EnumerateWebs ([Microsoft.SharePoint.SPWeb]$Web, [array]$Webs) {
  If ($Web.Webs.Count -gt 0) {
    $Webs = $Webs + $Web.Url
    ForEach ($SubWeb In $Web.Webs) {
      EnumerateWebs $SubWeb
    }
  }
  Else {
    $Webs = $Webs + $Web.Url
  }
  Return $Webs
}

# Show help and exit if no URL specified

If (!$URL -Or !$Style) {ShowHelp; Exit}
Switch ($Style) {
  "2007" {$VisualStyle = 3}
  "2010" {$VisualStyle = 4}
  Default {ShowHelp; Exit}
}

"`nSet-SPWebUIVersion`n"

# Load SharePoint Snap-In
"- Loading SharePoint PowerShell snap-in"
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

# Retrieve SharePoint Site
$Web = Get-SPWeb($URL) -ErrorAction SilentlyContinue

If (!$Web) {
  "`nERROR: Unable to open web site $URL"
  Exit
}

# Retrieve subsites
$Webs = EnumerateWebs $Web|Sort-Object
$Web.Dispose()

# Display site info
"`nDETAILS"
"Web Site: $URL"
"Sub Sites: $($Webs.Count)`n"
"Applying $Style style ...`n"

$Webs = $Webs|Sort-Object -Descending
ForEach ($WebURL In $Webs) {
  "- Reconfiguring $WebURL"
  $Web = Get-SPWeb $WebURL
  $Web.UIVersion = $VisualStyle
  $Web.Update()
  $Web.Dispose()
}
"`nDone!`n"

 

Copyright 2011 - 2024 The Lazy IT Admin | All Rights Reserved
menu-circlecross-circle linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram