My most recent project has been to migrate a bunch of sites from WSS 3.0 (SharePoint 2007) to SharePoint Server 2010. The users are currently working with WSS 3.0 and Office 2003, so the new ribbon based UI in 2010 will be completely new. My client wants to avoid the new SharePoint 2010 look and feel until they’ve had time to train their users, so we’ve been testing the upgrades by keeping them with the 2007 user interface. Permission to perform the Visual Upgrade One of the first things we noticed was the default permissions for who was allowed to switch the UI from 2007 to 2010. By default, site collection administrators and site owners can do this. Since we wanted to more tightly control the timing of the new UI, I added a few lines to the PowerShell script that we are using to perform the migration. This script creates the web application, sets the User Policy, and then does a Mount-SPDatabase to attach the old 2007 content database to the 2010 farm. I added the following steps after the Mount-SPDatabase step: #Remove the visual upgrade option for site owners
# it remains for Site Collection administrators
foreach ($sc in $WebApp.Sites){
foreach ($web in $sc.AllWebs){
#Visual Upgrade permissions for the site/subsite (web)
$web.UIversionConfigurationEnabled = $false;
$web.Update();
}
}
These script steps loop through each Site Collection in a particular web application ($WebApp) and then it loops through each subsite ($web) in the Site Collection ($sc) and disables the Site Owner’s permission to perform the Visual Upgrade. This is equivalent to going to the Site Collection administrator settings page –> Visual Upgrade and selecting “Hide Visual Upgrade”.
Since only IT people have Site Collection administrator privileges, this will allow IT to control the timing of the new 2010 UI rollout.
Newly created subsites
Our next issue was brought to our attention by SharePoint Joel’s blog post last week (http://www.sharepointjoel.com/Lists/Posts/Post.aspx?ID=524 ). In it, he lists some updates about the 2010 upgrade, and his fourth point was one that I hadn’t seen yet:
4. If a 2007 upgraded site has not been visually upgraded, the sites created underneath it will look like 2010 sites – While this is something I’ve been aware of, I think many don’t realize how this impacts common look and feel for master pages, and how it impacts good navigation and UI. As well depending on your patch level you may see hanging behavior in the list picker. The site and list creation Silverlight control in Internet Explorer is looking for resources that don’t exist in the galleries in the 2007 site, and hence it continues to spin and spin and eventually time out. The work around is to upgrade to SP1, or use Chrome or Firefox which won’t attempt to render the Silverlight control. When the root site collection is a 2007 site and has it’s set of galleries and the children are 2010 sites there is some strange behavior linked to the way that the galleries work and pull from the parent.
Our production SharePoint 2010 Farm has SP1 installed, as well as the December 2011 Cumulative Update, so I think the “hanging behavior” he mentions won’t affect us.
However, since we want to control the roll out of the UI, we are concerned that new subsites will have the 2010 look and feel, no matter what the parent site has.
Ok, time to dust off my developer skills.
I first looked into using feature stapling, but I couldn’t get that to work (although I’m pretty sure I had everything wired up correctly). Then I stumbled upon SharePoint 2010’s web events – a great way to handle this.
Using Visual Studio 2010, I created a new SharePoint project and added a Web Event Receiver:
In the Event Receiver class, I used the WebProvisioned method to check if the parent site is a 2007 site (UIVersion = 3), and if so, then set the newly created site to 2007:
/// <summary>
/// A site was provisioned.
/// </summary>
public override void WebProvisioned(SPWebEventProperties properties)
{
base.WebProvisioned(properties);
try
{
SPWeb curweb = properties.Web;
if (curweb.ParentWeb != null)
{
//check if the parent website has the 2007 look and feel
if (curweb.ParentWeb.UIVersion == 3)
{
//since parent site has 2007 look and feel
// we'll apply that look and feel to the current web
curweb.UIVersion = 3;
curweb.Update();
}
}
}
catch (Exception)
{
//TODO: Add logging for errors
}
}
This event is part of a Feature that is scoped to the Site Level (Site Collection). I added a couple of lines to my migration PowerShell script to activate the Feature for any site collections that we migrate.
Plan Going Forward
The plan going forward is to perform the visual upgrade after the users for a particular site collection have gone through 2010 training. If we need to do several site collections at once, we’ll use a PowerShell script to loop through each site collection to update the sites to 2010. If it’s just one or two, we’ll be using the “Update All Sites” button on the Visual Upgrade page for Site Collection Administrators.
The custom code for newly created sites won’t need to be changed, since it relies on the UI version of the parent site. If the parent is 2010, then the new site will look 2010.