Migrating Sharepoint 2007 Lists to 2010 Reply

Mike BerrymanUpgrading custom web parts from Sharepoint 2007 to Sharepoint 2010 can be an iffy prospect at best, but I recently ran into situation I had yet to encounter while doing such an update.  I had a web part that used a few custom lists to both configure and control the web part and capture user input.  While the web part itself was actually quite easy to get working in 2010 (when does that ever happen?), the lists posed a problem.

Normally when I move a web part that is tied into some sharepoint lists between systems, I’ll save the lists as a list template with the list content, if necessary.  From there, you can download the list template (an .stp file), upload it to the new system and create the necessary list from the template – easy as pie.  It turns out, however, that despite the relatively simplistic nature of these lists, sharepoint 2010 does not play well with templates generated from sharepoint 2007, generating a “Microsoft SharePoint Foundation version 3 templates are not supported in this version of the product” error.  This was irritating for me because while I could manually recreate the list schemas in sharepoint 2010 given how simple the custom lists actually were, that would mean having to manually recreate all the content across all the necessary lists that the web part needed to function.

Tedious busy work?  Not on my watch!

Manually recreating the lists was only a last resort option.  Luckily, a little bit of google-fu revealed a deceptively simple way to “upgrade” those 2007 list templates to be compatible with 2010.  It turns out, list template files (.stp) are really just cabinet files (.cab) in disguise, and it only holds one xml file: manifest.xml.  This manifest.xml file contains the list definition and, if any, all the list contents.  As it turns out, one of the nodes of the manifest.xml file is called “ProductVersion”, and is set to 3.  This property is located near the top of the manifest.xml file:

<?xml version="1.0" encoding="UTF-8" ?>
<ListTemplate WebUrl="http://weburl">

What I ended up doing is extracting the manifest.xml from my .stp list template, modifying that one little property so that ProductVersion was now set to 4, and repackaged it back up into a .cab file (I used the makecab.exe windows utility, located in the system32 directory).  Once the extension was changed from .cab to .stp, I was able to successfully upload the list template into sharepoint 2010 and use it to create the lists I needed, content and all.

Such a simple 3 minute workaround for what could potentially be a major headache when migrating between sharepoint versions.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s