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

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

SharePoint 2013 (SP 15) - Creating Custom Lists

As I am exploring SharePoint 2013, I found out that there are lot of things that are new and there are lot of thing that are old but presented in a different manner as compared to SharePoint 2010. For example, Site Actions was on the top left corner in SP 2010. But in SP 15 (SharePoint 2013) we dont have ‘Site Actions’ button. But instead we have a settings icon which is placed at top right corner. When you click on the settings icon select Add an App. This will basically allow you to add custom lists, documents libraries etc. Add an App is basically the same as More Options in SharePoint 2010. From now on custom lists & libraries will be called apps. Just like in Apple store or Android store you can develop apps for SharePoint and sell it. You can find more information here: http://officepreview.microsoft.com/en-us/store/apps-for-sharepoint-FX102804987.aspx When you click on Add an App you will be navigated to a different scree which will display different opti

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