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

Error while activating feature - SharePoint 2010

Hi all, While I was working on SharePoint 2010 recently I came across some issues. I am putting them across so that anyone facing the same issue may find solution easily. Error: Error occurred in deployment step 'Activate Features': Feature with Id xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' is not installed in this farm, and cannot be added to this scope. Solutions: I was getting this error while ‘deploy’ing a feature from Visual Studio 2010. I searched the entire project for this GUID which is mentioned in the error. I did not find it anywhere. While troubleshooting, I opened the physical folder and opened ‘Feature1.feature’ file in notepad. This xml file was using the before mentioned GUID. I was not able to find it in VS 2010 :( I copied the GUID mentioned in the ‘Feature1.feature’ file and pasted it in the Feature ID section in ‘Feature1.Template.xml’ file. This solved the problem. Why I thought to mention it is because the exception thrown is confusing. It does not tell you...

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...

Custom People Picker (Editor) in SharePoint 2010

[Modified:11 Oct 2010] Now you can find the source code for this example in CodePlex The out-of-the-box SharePoint people picker allows users to select users, SharePoint groups, Distribution Lists & Security groups . Users may accidentally add large AD groups to SharePoint groups and send notifications to hundreds of people. The administrator may want more control over the security of the people picker control. In some scenario the administrator may want to restrict the user to only select ‘users’ or ‘SharePoint Groups’. This can be achieved by creating a custom people picker control which inherits from SharePoint people editor. In below example, we are going to explore creation of custom people picker control, replace the OOTB people editor control, provide a people picker settings page in central administration and create menu to access the settings page in Central Administration. 1. Create custom people picker For creating a custom control (which inherits from SharePoint PeopleE...