Skip to main content

Migrating list or library from SharePoint 2007 (MOSS) to SharePoint 2010






There are many situations when you want to migrate data from SharePoint 2007 (MOSS) to SharePoint 2010. Microsoft has provided lot of material on upgrade or migrate to SharePoint 2010. This is the best starting point. I also have written about the steps to upgrade or migrate TFS 2008 team portals to TFS 2010 team portals. Basically I have considered upgrading and migrating from SharePoint 2007 to SharePoint 2010. You can find the blog post here...


But a situation may also arise where you are required to migrate only certain lists or libraries. In this blog post we will see how you can migrate only certain lists or libraries. The approach for migrating SharePoint 2007 lists and libraries is to save them as list templates with content and migrate them to SharePoint 2010 site.


But unfortunately SharePoint 2007 list templates (version 3) are not supported in SharePoint 2010. For this reason, we have to convert SharePoint 2007 list templates to be SharePoint 2010 compatible. For making list templates compatible we can use PowerShell scripts. I have listed down the prerequisites and steps for converting SharePoint 2007 list templates to be compatible with SharePoint 2010.


1 Prerequisites


Since we will be manually converting the list templates, we will require some tools and will have to follow the below steps


1. List templates from SharePoint 2007 lists and libraries,

2. Three folders : Input to store SharePoint 2007 list templates,

3. Output to store SharePoint 2010 compatible list templates,

4. Processed to store SharePoint 2007 list templates that have been processed,

5. 7z.exe to extract the site template files. We can get it from http://www.7-zip.org/


6. Makecab.exe to prepare a cab file. This is already available in WINDOWS\System32 folder


2 PowerShell Script


Now that we have all the prerequisites, we will make use of the PowerShell scripts to modify the site template file and make them ready for SharePoint 2010. Please use the following PowerShell script.



# Set Root Directory
$RootDir = "C:\Migration\" #Ensure it has a trailing backslash ('\')
Set-Alias sz ("C:\path\to\7zip\7z.exe") #7Zip exe path
Set-Alias mcab ("C:\windows\system32\makecab.exe")
#  Get list of all STP files
$InputDir = get-childitem ($RootDir + "input")
foreach ($item in $InputDir | where {$_.extension -eq ".stp"})

{
     $targetFile = ($RootDir + "input\" +$item.name)     $extractPath = $targetFile.substring(0,$targetFile.length-4)
     "Processing: " + $targetFile 
 #Create directory
     New-Item $extractPath -type
directory 
     #Expand STP File
     $extractPathOption = ("-o" + $extractPath)
     sz
x
$extractPathOption $targetFile
     #Replace files
     $manifestFileIn = $extractPath + "\manifest.xml"
     $manifestFileOut = $extractPath + "\manifestOut.xml"
     (Get-Content $manifestFileIn | Foreach-Object {$_ -replace "<ProductVersion>3</ProductVersion>", "<ProductVersion>4</ProductVersion>"} | Set-Content $manifestFileOut)
     #Cleanup files
     Remove-Item $manifestFileIn
     Rename-Item $manifestFileOut $manifestFileIn 
     #Recompress
(MakeCab)
     $itemNoExtension = $item.name.substring(0,$item.name.length-4)
     $CabFileName = ($RootDir + "\output\" + $itemNoExtension  + ".cab")
     $NewSTPFileName =  ($RootDir + "\output\" + $itemNoExtension  + ".stp")
     mcab $manifestFileIn $CabFileName
     #Rename cab, and move to output folder
     Rename-Item $CabFileName $NewSTPFileName
     Remove-Item $manifestFileIn
     Remove-Item $extractPath
     #Move original file to
processed folder
     Move-Item $targetFile ($RootDir + 'processed')

}


3. Create List or Library


Once the list templates are converted to SharePoint 2010 compatible, we need to upload them in list templates gallery in SharePoint 2010 site collection. Now we can proceed to creating new list or library from these templates.


Special thanks to: Peter Heydon


-Vighnesh Bendre


Comments

colinbashbash said…
We're looking at moving from VSS to TFS 2010. We currently have a relatively new Sharepoint 2007 site that will be converted to Sharepoint 2010 early next year, once the company has moved everyone to windows7/office2010.

Ok, so the two ways I see it, we can setup TFS to use WSS and then convert it to use MOSS 2010 next year. Or we can setup TFS to use MOSS 2007 and then convert it to use MOSS 2010 next year.

Any idea which is going to be more problematic? Can you expand on why? I couldn't find anything that seemed to relate specifically to TFS when migrating from MOSS 2007 to MOSS 2010. There's this information, but it's for converting from WSS to MOSS 2010: http://msdn.microsoft.com/en-us/library/ee462861.aspx

Any insight would be greatly appreciated.
vinay said…
Vignesh,

This is is a nice post. Great! What if if the list has more data say more than 500 MB of data and then migrate that to 2010 environment? As you know if the list has more than 500 MB of data it cannot be saved as a template.

Thanks,

Vinay.

Popular posts from this blog

Working with large xml files in c# .net

Working with large (huge) xml files is always a pain in the … The reason? These files can’t be loaded in to memory. On my desktop, where I have 2 gigs memory, I can’t open the file in even notepad. I was presented with a challenge recently to manipulate one such large xml file. The xml file was of 550+ MB. I know many would say I have seen bigger xml files than this. But the heart of the matter is if I can’t open 550+ MB file in notepad or in xmldocument in c#, then I can’t open any file bigger than this. And hence the logic to play with these files would remain same. The scenario: We have an xml file from which we want to remove a single node without removing its children. In the below sample xml fragment, the node has to be removed. The children nodes, must then be attached to ( node’s parent) node. One Two 100.22 GoodDay 3 4 Five 200.09 Cra

Create list view - Conditional Formatting in SharePoint Designer 2010

In this example, we are going to format a column based on certain condition. Here I already have a list called Projects. I also have workflow associated with it. So whenever I create a new item in the list, workflow status column shows ‘In Progress’. Subsequently when the workflow in completed, the workflow status column shows ‘Completed’. For demonstration purpose, I will set the background color of workflow status column to yellow when the status is ‘In Progress’ and to green when the status is ‘Completed’. In SharePoint Designer open the site on which you are working. Click on ‘Lists and Libraries’ link. Choose the ‘Projects’ list. In SharePoint Designer Navigation, choose ‘Lists and Libraries’. In the list settings page, click on ‘New’ in ‘Views’ section. Provide appropriate name for the view and click OK. After choosing list, click on ‘New’ in the Views section. Give appropriate name to the list. Now click on any column, then in the ribbon, click on List View Tools-&g

Upgrade and Migration for SharePoint Foundation 2010

      1.1 Introduction Microsoft SharePoint Foundation 2010 has been designed for scale and performance and as such requires new hardware and software requirements. There are 3 major steps while upgrading. 1. Plan and Prepare 2. Perform a database attach upgrade 3. Verify upgrade 1.2 Plan and Prepare   Before we run any process to upgrade from Windows SharePoint Services 3.0 to Microsoft SharePoint Foundation 2010, we have to determine which upgrade approach to take. In our scenario, Database Attach Upgrade seems to be appropriate approach to follow. We can upgrade the content for the environment on a separate farm. The result is that you do not upgrade any of the services or farm settings. You can upgrade the databases in any order and upgrade several databases at the same time. While each database is being upgraded, the content in that database is not available to users. 1.2.1 Upgrade Approach A database attach upgrade enables you to move to new hardware or a