SharePoint 2010 to Office 365 Migration

By

The Office 365 Migration API announced in July 2015, provides a method of migrating SharePoint On-Premises content to Office 365 via Azure Storage. This new migration API avoids throttling issues that are experienced when using CSOM to migrate content.

This post is written due to some frustrations I have witnessed and experienced myself when running through the steps outlined in this technet article: https://blogs.technet.microsoft.com/nishants/2015/07/18/using-windows-powershell-cmdlets-for-sharepoint-online-o365spo-migration/

There are some issues with the post whereby some of the PowerShell commands do not work. These are related to missing files such as lookuplistmap.xml, and errors after submitting the cmdlets such as file not found, and unauthorized errors. Additionally you may find that Export-SPWeb fails to find your on-premises SharePoint environment.

Pre-Requisites

It is assumed that you will have an Office 365 subscription with a site collection that you would like to migrate your content to. In addition, you will need to:

  1. Create a Azure Storage resource (Instructions to do so can be found here)
  2. You will need to install the SharePoint Online Management Shell version 16.0.4017.1200 or above. However, that in itself has some pre-requisites. You will need to also install the SharePoint PowerShell 3.0 prior to the Online Management Shell, which may also prompt you to install Service Pack 1 if running SharePoint 2010 on a Windows Server 2008 R2 machine.
  3. The new Migration API will migrate your metadata for both lists and document libraries. However, the columns do need to be created in the target list or library within SharePoint Online first with the same name and same data type. You cannot create the column after the migration and expect them to display the values.

 

IMPORTANT

Before we go any further, you will find that the PowerShell command fails when trying to run the command: Export-SPWeb. The error: “Cannot find an SPWeb object with Id or Url :” is due to the fact that although SharePoint PowerShell 3.0 was required for the SharePoint Online Management Shell to be installed, the SharePoint PowerShell 3.0 is incompatible with SharePoint 2010. We must therefore force the SharePoint 2010 Management Shell to use SharePoint PowerShell 2.0.

image

 

To force the SharePoint 2010 Management Shell to use Version 2.0, follow these steps:

  1. Right click the shortcut to the SharePoint 2010 Management Shell
  2. Click Properties
  3. Replace the Target on the Shortcut tab with:

C:\Windows\System32\WindowsPowerShell\v1.0\PowerShell.exe -Version 2.0 -NoExit  ” & ‘ C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\CONFIG\POWERSHELL\Registration\\sharepoint.ps1 ‘ ”

image

 

There are four main steps in migrating your SharePoint On-Premises content to Office 365 SharePoint Online.

  1. Export the data from the SharePoint 2010 environment using Export-SPWeb. (covered in step 1).
  2. Convert the Exported package to an SPO Migration Package.
  3. Upload the SPO Migration Package to your Azure Storage account
  4. Submit the Migration Job.

 

Step 1

IMPORTANT – Make sure that you have modified the Target field for the SharePoint 2010 Management Shell. (NOTE: that this is not the SharePoint Online Remote Management Shell)

    1. Run the SharePoint 2010 Management Shell as Administrator.image
    2. Run the following command, replacing the WebURL and the Document Library with your own:Export-SPWeb -Identity “http://<On-PremSPSite>” -ItemUrl “/OnPremDocLib” -Path “C:\SPOnPremExport” -NoFileCompression -IncludeVersions 4

      image

    3. This should complete successfully. If it has, check the folder has been created with the contents as shown below:image

      NOTE: Although this completed successfully – it is missing a file! The file is important, otherwise you will not be able to complete the next step.

      The LookupListMap.XML file is missing from the Export. However, you can create it manually.

    4. Create a new XML file in the above exported folder with the name: LookupListMap.xml.
    5. Add the following lines of XML to the file:

<?xml version=”1.0″ encoding=”utf-8″?>
< LookupLists xmlns=”urn:deployment-lookuplistmap-schema”/>

 

Step 2

We are now done with the SharePoint 2010 Management Shell. The next step involves using the SharePoint Online Management Shell.

  1. Copy the contents of your export folder to a new path: “C:\migrationpackages\SPOTemp”
  2. Choose Start, SharePoint Online Management Shell, Run ISE as Administrator 

    image

  3. Within the ISE, paste the command:Connect-SPOService -Url https://<TENANT>-admin.sharepoint.com

    image

  4. Enter the username and password when prompted with the Tenant Admin Username and Password.
  5. Run the ConvertTo-SPOMigrationTargetedPackage command as per below:ConvertTo-SPOMigrationTargetedPackage -SourceFilesPath “C:\MigrationPackages\SPOTEMP” -SourcePackagePath “C:\MigrationPackages\SPOTEMP” -TargetDocumentLibraryPath “C:\MigrationPackages\SPOMigrationPackage” -TargetWebUrl https://<your tenant>.sharepoint.com/ -OutputPackagePath c:\migrationpackages\SPOutPutPackage

    image

  6. The SPOutPutPackage folder should have been created with the contents as shown below:image

Step 3

Within step three, we will upload the package to Azure Storage:

  1. Use the following command:image

    $azurelocations = Set-SPOMigrationPackageAzureSource -SourceFilesPath “C:\MigrationPackages\SPOTEMP” -SourcePackagePath “C:\MigrationPackages\SPOutPutPackage” -FileContainerName migration-files -PackageContainerName migration-package -AccountName “yourstoragestorage” -AccountKey “AZURE STORAGE KEY”

  2. You can obtain your Azure Storage Key and Storage name from your Azure portal as per below: 

    image

  3. You will be prompted again for the credentials for your Office 365 environment.

Step 4

 

The final step is to submit the job to copy the contents across to the SharePoint Online List or Library.

 

  1. To submit the job, please enter the following:Submit-SPOMigrationJob -TargetWebUrl https://yourtenant.sharepoint.com/ -MigrationPackageAzureLocations $azurelocations

    image

 

If you refresh your document library within Office 365, you should find that your content has been migrated. Note that this can take a while. It will take less time if you make sure your Azure account is hosted on the same region as your Office 365 tenant.

 

I hope this helps!

 

Brett Lonsdale