Migration can be achieved in four different ways.
  1. Using Power shell Script.
  2. Using Third Party Tool like Sharegate
  3. Using List Template.
  4. Microsoft Access 2013.
In this blog, we will discuss only using power shell script.
  • Open window powershell in source machine.
  • Before running export command please change the WebURL to Source Site URL, ListName is the list which we need to migrate and provide the physical path to save the export file. Export-List -WebUrl "http://yoursite:portnumber/" -ListName"ExistingDemo" -Path "D:\ExistingDemoExport" -Overwrite
  • Run the export command in powershell window. When export command is successful following file will find in physical location.

  • Open the file into notepad. i.e. SystemData.xml
  • Change the version and build attributes value in SystemData.xml file according to the new environment.

  • To change the build attribute value open Central Administration on destination site and navigate to Upgrade and Migration->Check product and patch installation status. Copy the highlighted text and replace the build attribute value in SystemData.xml file.
  • Version attribute value will be:

    Sharepoint 2010 : Version="14.0.0.0"
    Sharepoint 2013 : Version="15.0.0.0"
  • After replacing build and attribute value as per above description. Save the SystemData.xml file at same location.
  • Open Window Powershell at destination site and run the export command after amending below line in Import command.
Import-List -WebUrl “http://intranet/sites/sales” -Path ""D:\ExistingDemoExport""
Using Power Shell Script
Export Command
  1. function Export - List {
  2. Param(
  3. [parameter(Mandatory = $true)][string] $WebUrl,
  4. [parameter(Mandatory = $true)][string] $ListName,
  5. [parameter(Mandatory = $true)][string] $Path,
  6. [parameter(Mandatory = $false)][
  7. switch
  8. ] $ExcludeDependencies,
  9. [parameter(Mandatory = $false)][
  10. switch
  11. ] $HaltOnWarning,
  12. [parameter(Mandatory = $false)][
  13. switch
  14. ] $HaltOnNonfatalError,
  15. [parameter(Mandatory = $false)][
  16. switch
  17. ] $AutoGenerateDataFileName,
  18. [parameter(Mandatory = $false)][
  19. switch
  20. ] $TestRun,
  21. [parameter(Mandatory = $false)][string] $IncludeSecurity,
  22. [parameter(Mandatory = $false)][string] $IncludeVersions,
  23. [parameter(Mandatory = $false)][int] $FileMaxSize,
  24. [parameter(Mandatory = $false)][
  25. switch
  26. ] $Overwrite,
  27. [parameter(Mandatory = $false)][
  28. switch
  29. ] $SuppressLog)
  30. #Load SharePoint 2010 cmdlets
  31. $ver = $host | select version
  32. if ($ver.Version.Major - gt 1) {
  33. $Host.Runspace.ThreadOptions = "ReuseThread"
  34. }
  35. Add - PsSnapin Microsoft.SharePoint.PowerShell - ErrorAction SilentlyContinue
  36. #Load assemblies(needed
  37. for SharePoint Server 2007)[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
  38. #Check parameters have the correct values
  39. if (!$IncludeSecurity) {
  40. $IncludeSecurity = "None"
  41. } else {
  42. if (($IncludeSecurity - ne "All")
  43. `
  44. -and ($IncludeSecurity -ne "WssOnly") ` - and($IncludeSecurity - ne "None")) {
  45. Throw "The IncludeSecurity parameter must be set to All, WssOnly or None"
  46. }
  47. }
  48. if (!$IncludeVersions) {
  49. $IncludeVersions = "LastMajor"
  50. } else {
  51. if (($IncludeVersions - ne "All")
  52. `
  53. -and ($IncludeVersions -ne "CurrentVersion") ` - and($IncludeVersions - ne "LastMajor")
  54. `
  55. -and ($IncludeVersions -ne "LastMajorAndMinor"))
  56. {
  57. Throw "The IncludeVersions parameter must be set to All, CurrentVersion, LastMajorAndMinor or LastMajor"
  58. }
  59. }
  60. if (!$FileMaxSize)
  61. {
  62. $FileMaxSize = 0
  63. }
  64. $site = New-Object Microsoft.SharePoint.SPSite($WebUrl)
  65. $web = $site.OpenWeb()
  66. $list = $web.Lists[$ListName]
  67. [bool]$FileCompression = $false
  68. #Set file paths for the export file and logs
  69. [string]$exportPath = $Path.TrimEnd("\")
  70. if ($exportPath.EndsWith(".cmp"))
  71. {
  72. $FileCompression = $true
  73. $exportFile = $Path.Replace($Path.Remove($Path.LastIndexOf("\")+1),"")
  74. $exportPath = $Path.Remove($Path.LastIndexOf("\"))
  75. }
  76. $logFilePath = $exportPath + "\exportlog.txt"
  77. New-Item -Path $logFilePath -Type File -Force | Out-Null
  78. Write-Host "Export log file created at" $logFilePath
  79. $exportObject = New-Object Microsoft.SharePoint.Deployment.SPExportObject
  80. $exportObject.Id = $list.ID
  81. $exportObject.Type = [Microsoft.SharePoint.Deployment.SPDeploymentObjectType]::List
  82. #Create the export settings from the parameters specified
  83. $exportSettings = New-Object Microsoft.SharePoint.Deployment.SPExportSettings
  84. $exportSettings.SiteUrl = $site.Url
  85. $exportSettings.ExportMethod = [Microsoft.SharePoint.Deployment.SPExportMethodType]::ExportAll
  86. $exportSettings.FileLocation = $exportPath
  87. $exportSettings.FileCompression = $FileCompression
  88. if ($FileCompression) { $exportSettings.BaseFileName = $exportFile }
  89. $exportSettings.ExcludeDependencies = $ExcludeDependencies
  90. $exportSettings.OverwriteExistingDataFile = $Overwrite
  91. $exportSettings.IncludeSecurity = $IncludeSecurity
  92. $exportSettings.IncludeVersions = $IncludeVersions
  93. $exportSettings.LogFilePath = $logFilePath
  94. $exportSettings.HaltOnWarning = $HaltOnWarning
  95. $exportSettings.HaltOnNonfatalError = $HaltOnNonfatalError
  96. $exportSettings.AutoGenerateDataFileName = $AutoGenerateDataFileName
  97. $exportSettings.TestRun = $TestRun
  98. $exportSettings.FileMaxSize = $FileMaxSize
  99. $exportSettings.ExportObjects.Add($exportObject)
  100. #Write the export settings to a log file
  101. Out-File -FilePath $logFilePath -InputObject $exportSettings -Append -Encoding utf8
  102. #Run the export procedure
  103. $export = New-Object Microsoft.SharePoint.Deployment.SPExport($exportSettings)
  104. $export.Run()
  105. #Load notepad showing the log file
  106. if (!$SuppressLog) { notepad $logFilePath }
  107. #Dispose of the web and site objects after use
  108. $web.Dispose()
  109. $site.Dispose()
  110. }
  111. Export-List -WebUrl "yoursite" -ListName "listname" -Path "E:\arvind\ForMigration\FromLive\Incident" -Overwrite
Import Command
  1. function Import - List {
  2. Param(
  3. [parameter(Mandatory = $true)][string] $WebUrl,
  4. [parameter(Mandatory = $true)][string] $Path,
  5. [parameter(Mandatory = $false)][
  6. switch
  7. ] $HaltOnWarning,
  8. [parameter(Mandatory = $false)][
  9. switch
  10. ] $HaltOnNonfatalError,
  11. [parameter(Mandatory = $false)][
  12. switch
  13. ] $RetainObjectIdentity,
  14. [parameter(Mandatory = $false)][string] $IncludeSecurity,
  15. [parameter(Mandatory = $false)][string] $UpdateVersions,
  16. [parameter(Mandatory = $false)][
  17. switch
  18. ] $SuppressLog)
  19. #Load SharePoint 2010 cmdlets
  20. Add - PSSnapin Microsoft.SharePoint.PowerShell - erroraction SilentlyContinue
  21. #Load assemblies(needed
  22. for SharePoint Server 2007)[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
  23. #Check parameters have the correct values
  24. if (!$IncludeSecurity) {
  25. $IncludeSecurity = "None"
  26. } else {
  27. if (($IncludeSecurity - ne "All")
  28. `
  29. -and ($IncludeSecurity -ne "WssOnly") ` - and($IncludeSecurity - ne "None")) {
  30. Throw "The IncludeSecurity parameter must be set to All, WssOnly or None"
  31. }
  32. }
  33. if (!$UpdateVersions) {
  34. $UpdateVersions = "Overwrite"
  35. } else {
  36. if (($UpdateVersions - ne "Overwrite")
  37. `
  38. -and ($UpdateVersions -ne "Append") ` - and($UpdateVersions - ne "Ignore")) {
  39. Throw "The UpdateVersions parameter must be set to Overwrite, Append or Ignore"
  40. }
  41. }
  42. $site = New - Object Microsoft.SharePoint.SPSite($WebUrl)
  43. $web = $site.OpenWeb()
  44. $importSettings = New - Object Microsoft.SharePoint.Deployment.SPImportSettings
  45. #Set file paths
  46. for the
  47. import file and logs
  48. $fileName = ""
  49. if ($Path.EndsWith(".cmp")) {
  50. $fileName = $Path.Replace($Path.Remove($Path.LastIndexOf("\")+1),"
  51. ")
  52. $importPath = $Path.Remove($Path.LastIndexOf("\"))
  53. $importSettings.FileCompression = $true $importSettings.BaseFileName = $fileName
  54. }
  55. else {
  56. $importPath = $Path.TrimEnd("\")
  57. $importSettings.FileCompression = $false
  58. }
  59. $logFilePath = $importPath + "\importlog.txt"
  60. New - Item - Path $logFilePath - Type File - Force | Out - Null
  61. Write - Host "Import log file created at"
  62. $logFilePath
  63. #Create the
  64. import settings from the parameters specified
  65. Write - Host "Configuring import settings"
  66. $importSettings.SiteUrl = $site.Url
  67. $importSettings.WebUrl = $web.Url
  68. $importSettings.FileLocation = $importPath
  69. $importSettings.IncludeSecurity = $IncludeSecurity
  70. $importSettings.UpdateVersions = $UpdateVersions
  71. $importSettings.LogFilePath = $logFilePath
  72. $importSettings.HaltOnWarning = $HaltOnWarning
  73. $importSettings.HaltOnNonfatalError = $HaltOnNonfatalError
  74. $importSettings.RetainObjectIdentity = $RetainObjectIdentity
  75. $importSettings.UserInfoDateTime = "ImportAll"
  76. if (!$SuppressLog) {
  77. $importSettings
  78. }
  79. #Write the
  80. import settings to a log file
  81. Out - File - FilePath $logFilePath - InputObject $importSettings - Append - Encoding utf8
  82. #Run the
  83. import procedure
  84. Write - Host "Import running, please wait..."
  85. $import = New - Object Microsoft.SharePoint.Deployment.SPImport($importSettings)
  86. $import.Run()
  87. Write - Host "Import from"
  88. $Path "complete"
  89. #Load notepad showing the log file
  90. if (!$SuppressLog) {
  91. notepad $logFilePath
  92. }
  93. #Dispose of the web and site objects after use
  94. $web.Dispose()
  95. $site.Dispose()
  96. }
Import-List -WebUrl “http://intranet/sites/sales” -Path "C:\Export\TeamContacts"