Wednesday, December 30, 2009

Converting a Site Definition from SharePoint Portal Server 2003 to MOSS 2007

Unfortunately, the Site Definitions from SharePoint Portal Server 2003 (SPS2003) to Microsoft Office SharePoint Server 2007 (MOSS 2007) have changed quite a bit. Well, unfortunately because it means more work for the conversion. The good news is that it is a much better model and easier to work with.

There are two things to consider here. One thing is that you will need an updated Site Definition, and the other is that you will need to map all previous standard SPS2003 paths to the ones used by MOSS 2007. The two things are related, but understanding the differences can help in troubleshooting any problems you may have.

Let’s start by looking at the files we need to have to do each.

Site Definition Files

C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\SiteTemplates\MyCustomSiteDefinition

C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\1033\XML\WEBTEMPMyCustomSiteDefinition.xml

Mapping files for Site Definition

C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\CONFIG\UPGRADE\MyCustomSiteDefinitionWssUpgrade.xml

Your Site Definition files can be added to any MOSS 2007 installation and then you will be able to create new sites that use your Site Definition. If you can do that and the site you create works as expected then this means that your Site Definition files are good. These are all you would need if you were just creating a new Site Definition for MOSS 2007.

The Mapping files are needed for when the site is migrated by the upgrade process from SPS2003 to MOSS2007. It needs to map all path that were used in SPS2003 to MOSS2007 compatible paths. This file is only applied once when the upgrade process runs. In fact, once it is applied I can’t find a way to apply it again without starting over with a virgin SPS2003 content database.

Creating a new Site Definition

I am by no means an expert at getting site definitions to work. All I have done is in SPS2003, I copied the STS Site Definition and made some very minor tweaks to it. Now I am in MOSS2007 and want to again make those very basic tweaks so that I can have all the functionality of MOSS2007 team sites. This means in my scenario the easiest way to continue is to not try to convert my existing Site Definition from SPS2003, but to just copy the STS Site Definition from MOSS2007 and make my tweaks to it.

Here is what I did.

  1. Go to C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\SiteTemplates and copy the sts directory and call it something unique like MySts. Make your tweaks as needed.
  2. Go to C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\1033\XML\ and create a file called something like WEBTEMPMySts.xml. It MUST MUST MUST start with WEBTEMP and end in .xml, the rest is not important but should be meaningful to you. If you are copying the STS Site Definition like I am, here is all you need in that file. If you are doing something else, you’ll have to decide what you put in it.

    <?xml version="1.0" encoding="utf-8" ?>
    <!-- _lcid="1033" _version="12.0.4518" _dal="1" -->
    <!-- _LocalBinding -->
    <Templates xmlns:ows="Microsoft SharePoint">
    <Template Name="MySts" ID="30001">
    <Configuration ID="0" Title="My Team Site" Hidden="FALSE" ImageUrl="/_layouts/images/stsprev.png" Description="This template creates a site for teams to create, organize, and share information quickly and easily. It includes a Document Library, and basic lists such as Announcements, Events, Contacts, and Quick Links." DisplayCategory="Collaboration"> </Configuration>
    <Configuration ID="1" Title="My Blank Site" Hidden="FALSE" ImageUrl="/_layouts/images/stsprev.png" Description="This template creates a Windows SharePoint Services-enabled Web site with a blank home page. You can use a Windows SharePoint Services-compatible Web page editor to add interactive lists or any other Windows SharePoint Services features." DisplayCategory="Collaboration"> </Configuration>
    <Configuration ID="2" Title="My Document Workspace" Hidden="FALSE" ImageUrl="/_layouts/images/dwsprev.png" Description="This template creates a site for colleagues to work together on documents. It provides a document library for storing the primary document and supporting files, a Task list for assigning to-do items, and a Links list for resources related to the document." DisplayCategory="Collaboration"> </Configuration>
    </Template>
    </Templates>
    You don’t have to use 30001, but it does have to be unique with regards to Microsoft Standard ids (so don’t use 1, etc). I think it is anything over 10000 is for user created Site Definitions, but 30000+ is definitely a safe range.
    Check out Upgrading SharePoint Server 2003 Customizations to SharePoint Server 2007 under the Upgrading Custom Site Templates section more information.

Creating the mapping file

The mapping file is used for conversion only.

Go to the C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\CONFIG\UPGRADE directory

Since we are doing the STS site, all we have to do is copy the WssUpgrade.xml to another file and call it something like MyStsWssUpgrade.xml. The name is not important, but must be in this directory in order for the upgrade process to find it.

I then did the following

  1. Replace All: FromPath="{LocaleId}\STS with FromPath="{LocaleId}\MySts
  2. Replace All: ToPath=  "SiteTemplates\STS with ToPath=  "SiteTemplates\MySts
  3. Replace All: FromPath="{LocaleId}\STS\Lists with FromPath="{LocaleId}\MySts\Lists
  4. Change ID=”1” to ID=”30001”

In the end all paths should reference your MySts directory, not the STS directory

For more information on how to migrate from SPS2003 to MOSS2007, check out my other blog entry.

Verifying your conversion

For starters the site definition should look like you expect it to. In our scenario, it should look and act like all other MOSS 2007 sites, not like it used to.

Also, go to the MOSS 2007 content database using SQL Management Studio. Run the following query.

select fullurl, webtemplate, ProductVersion from webs order by productversion

If all the sites where converted to MOSS2007, they will have a ProductVersion = 3. If there are any that are not converted, they will have ProductVersion = 2. This will cause you grief down the road if you don’t get it to convert to version 3 and will also cause MOSS to run those sites in compatibility mode and there is a negative performance hit with that.

You can also review the log carefully. It should say that it upgraded each site. The log file is usually C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\LOGS

No comments: