I try to migrate my sharepoint library from on-premise SharePoint 2013 to SharePoint online. I do this by folowing SharePoint Online deployment advisor instructions.

I did this successfully:

Export-SPWeb -Identity http://contosoweb/sites/project01 -Path C:\migration\Project01Library -ItemUrl "Shared Documents" -NoFileCompression

I created an user mapping CSV file. It looks like:

s-1-5-21-79778582-742657681-665348310-13225,[email protected],False
s-1-5-21-79778582-742657681-665348310-11185,[email protected],False
s-1-5-21-79778582-742657681-665348310-13306,[email protected],False

After that I defined variables and tried to do this:

$finalPackages = ConvertTo-SPOMigrationTargetedPackage -ParallelImport -SourceFilesPath $sourceFiles -SourcePackagePath $sourcePackage -OutputPackagePath $targetPackage -Credentials $cred -TargetWebUrl $targetWeb -NoAzureADLookup -TargetDocumentLibraryPath $targetDocLib  -UserMappingFile $userMapFile 

But I got an error:

ConvertTo-SPOMigrationTargetedPackage : Object reference not set to an
instance of an object.
At line:1 char:18
+ $finalPackages = ConvertTo-SPOMigrationTargetedPackage -ParallelImport
-SourceFi ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [ConvertTo-SPOMigrationTargete
   dPackage], NullReferenceException
    + FullyQualifiedErrorId : System.NullReferenceException,Microsoft.Online.S

How to fix it? I have diferent domain in SharePoint online and on-premise SharePoint. Should be usernames in the mapping csv file from on-premise SharePoint or SharePoint online domain (well, the error is the same)?

2 Answers 2


If you want to migrate sharepoint library from on-premise SharePoint 2013 to SharePoint online, you can refer to this article.

About this error, you can check if it has any detail error message in the ULS log.

You can refer to the same issue in this article.


In such scenarios, I would suggest using SharePoint Migration Tool which supports SharePoint 2013, and it is a simple and fast solution to help you migrate content from on-premises SharePoint Server sites and file shares to SharePoint, OneDrive, and Microsoft Teams in Office 365.

Read more at How to use SharePoint Migration Tool

Regarding your issue, try to change the site collection administrator of this site as mentioned at Sharepoint online - ConvertTo-SPOMigrationTargetedPackage not working

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.