File Server Migration To SharePoint Online Using SPMT PowerShell

Recently we had a project where we needed to migrate file server to SharePoint Online. So, we decided to go with SharePoint Migration Tool (SPMT). But we had 50 plus folders and all were needed to migrate to different site document libraries. As it takes long time to migrate using tool due to creating connection, we decided to use the PowerShell version.

Issue

We faced the below issues in this requirement, 

  1. The documentation for this is not that accurate or in single place. We need to search here and there for things.
  2. SPMT tool migrates file server child items directly but when you use PowerShell, it migrates parent folder. Due to the curse of first point, it took some time for us to find the hidden solution. Go through this post to see that hidden gem.
  3. The last but not least is permission migration. SPMT has all this functionality but as I said earlier it is not documented well.

So, we will try to explain all our knowledge in detail here.

Solution

First, we need to prepare a csv which will be read by PowerShell and It will have connection details of source and migration.

Important notes for preparing csv,

  1. Do not include a header row in your CSV file.
  2. Remember to account for all six columns in the file, even if you are not needing a value for a given field.
  3. If you use the standard out-of-the-box Document library ("Shared Documents"), you must use the Display name "Documents" as the placeholder value for the Target Document Library in your CSV file. If you enter "Shared Documents" in that column, you will receive an "invalid document library" error.

Note

If the language of the destination SharePoint site is other than English, check the Display name of the "Shared Documents" Document library by browsing to Documents library.

The format of csv is as below,

Source, SourceDocLib, SourceSubFolder, TargetWeb, TargetDocLib, TargetSubFolder

As we are migrating from file server, we will not pass the “SourceDocLib” & “SourceSubFolder” details. So, our csv detail will look like below,

File server path,,, TargetWeb,TargetDocLib,TargetSubFolder

For example,

C:\MigrationTests\testfiles,,,https://contoso.sharepoint.com/sites/Sample/,DocLibraryName,DocLibraryName_subfolder

In case you don’t want to migrate it to sub folder, the subfolder part will be blank.

File server path,,, TargetWeb,TargetDocLib,

For example,

C:\MigrationTests\testfiles,,,https://contoso.sharepoint.com/sites/Sample/,DocLibraryName,

In next blog we will use this csv in the PowerShell.

Reference

  1. https://docs.microsoft.com/en-us/sharepointmigration/how-to-format-your-csv-file-for-data-content-migration