There are many options to consider if you want to migrate to SharePoint Online from an on premises SharePoint farm. Some of the options are more simple, but have restrictions and don’t copy across the meta data, document version history, and properties such as the document author or created date.
The options to migrate from SharePoint On-Premises to SharePoint Online include:
- Drag and Drop documents from Windows Explorer to the Document Library
- Click Upload within a document library to upload multiple files
- Save Site As Template
- Using OneDrive for Business to synchronize the document library
- Use a migration tool
- Use the Office 365 Migration API.
This article is going to explain how to migrate to SharePoint Online using the Office 365 Migration API. However, first let’s discuss some of the options and why using the Office 365 Migration API makes sense.
Migrating documents to SharePoint Online can be as easy as dragging and dropping a selection of documents into the library. Whilst this is a simple method and could perhaps be used for a handful of documents, there are limitations to it. Firstly the Created Date, and Created By meta data is not retained. The author of the document shows as the user dragging the content, and the timestamps are shown as the time the documents were uploaded. Version history is not included with this method, and it is also susceptible to CSOM throttling and file limits. Folders are also not included within a drag/drop.
It is possible to use the Save Site As Template or Save List As Template and include content. When creating a new list or site from the template in Office 365 SharePoint Online, your content will be present along with the Site Settings and List/Library Settings. The issue with this are mainly the save as migrating to SharePoint Online using Drag and Drop. The Author and Timestamps are set to the user who created the new site or list, versions are not included, and there is also a 50MB size limit which can be increased to 524MB.
You can click upload from within an Office 365 document library. The advantage this has over the Drag and Drop method, is that folders and their contents can be uploaded to the SharePoint Online Document Library. The same restrictions as the above methods also exist with regards to date time stamps and author information.
One Drive for Business can be used to sync documents with a document library in Office 365 SharePoint Online. This will include Folders and Files in one go, and there is a limit to 5000 items.
Perhaps the most complex method is to migrate to SharePoint Online using the Office 365 Migration API. This method is not particularly well documented. However, if you don’t have a budget for a migration tool, it is perhaps the fastest way of migrating all of your content along with metadata, timestamps and author information along with folders as well. Microsoft also throttle CSOM requests for the other methods above which is overcome using the Office 365 Migration API.
This method involves the following steps:
- Create an Azure Storage Account for Blob Storage
- Install the Microsoft SharePoint Online Management Shell
- Export the content of the list or library using Export-SPWeb
- Create a Migration Package New-SPOMigrationPackage or Export -SPWeb
- Re-map the Migration Package to Describe Objects in Target Web ConvertTo-SPOMigrationTargetedPackage
- Creates Azure Containers and Uploads packages to the containers within Azure Storage Set-SPOMigrationPackageAzureSource
- Submits the migration job Submit-SPOMigrationJob
- The first step is to create an Azure Storage Account which will temporarily store the content you are migrating as a blob. The advantage this method has is that once your content is uploaded to the Azure Storage, a local copy at data centre level is used to get your content into the Office 365 SharePoint Online Document Library. The steps to creating an Azure Storage Account can be found here: https://azure.microsoft.com/en-gb/documentation/articles/storage-create-storage-account/
- If you haven’t already, you will need to install the SharePoint Online Management Shell. There are some gotchas here if migrating from SharePoint 2010 which I have covered in this blog post. To install the SharePoint Online Management Shell, follow these steps: https://www.microsoft.com/en-gb/download/details.aspx?id=35588
- Create a Migration Package. To do this, you will open the SharePoint On-Premises Management Shell and run it as Administrator. Using the Export-SPWeb command, you will export the document library or list that you wish to migrate to SharePoint Online. The command is as per below:
- Export-SPWeb -Identity http://OnPremURL/sites/subsite -ItemUrl “/sites/subsite/shared%20documents” -Path “C:\SPOnPremExport” -NoFileCompression -IncludeVersions 4
- Copy the contents of c:\SPOnPremExport to a new folder path: c:\migrationpackages\SPOTemp
- Open the SharePoint Online Management Shell ISE and run the following commands to convert the package, upload the package to azure and submit your azure job:
- Connect to the SharePoint Online Tenant: Connect-SPOService -Url https://tenantname-admin.sharepoint.com
- Store the credentials in a variable to avoid an unauthorised error.
- $cred = Get-Credential
- Convert the Exported list or library to a migration package:
- ConvertTo-SPOMigrationTargetedPackage -SourceFilesPath “C:\MigrationPackages\SPOTEMP” -SourcePackagePath “C:\MigrationPackages\SPOTEMP” -TargetDocumentLibraryPath “/shared%20documents” -TargetWebUrl https://tenant.sharepoint.com/ -OutputPackagePath c:\migrationpackages\SPOTEMP -Credentials $cred
- Upload the package to your Azure Storage as a Blob:
- $azurelocations = Set-SPOMigrationPackageAzureSource -SourceFilesPath “C:\MigrationPackages\SPOTEMP” -SourcePackagePath “C:\MigrationPackages\SPOTEMP” -FileContainerName migration-files -PackageContainerName migration-package -AccountName “nameofyourstorage” -AccountKey “Wg3s3rF6yst6xg7Ee0R9+E9C/hkjfhdkjhfksdhkjfhsdkjfhksdjhff/wlBPdE1S4m3QvPbE3YyA==” -AzureQueueName “test”
- Submit the Job to be copied:
- Submit-SPOMigrationJob -TargetWebUrl https://tenant.sharepoint.com/ -MigrationPackageAzureLocations $azurelocations -Credentials $cred
- Your content will now be migrated pretty quickly and will include meta data/folders/version history etc. The method can be scripted to include all lists and libraries that you wish to migrate.
One issue with this method is that you will need to create the sites, lists and libraries and any custom columns before migrating. The advantage of using a migration tool is that the architecture of the sites/lists and libraries are also created. Nonetheless, this Office 365 migration api method is a huge timesaver.