Preserve SharePoint Document Authors During Library Migration
Question details
Preserve document authors, editors, dates, and version history when migrating an on-premises SharePoint library to SharePoint Online.

- Product
- SharePoint Online and SharePoint on-premises
- Device & OS
- not provided
- Scenario
- A PowerShell migration script uploads document versions to a new SharePoint Online library and attempts to restore their metadata.
- Observed behavior
- The script cannot reliably update the Author or Editor person fields and later reports that a file URL is invalid or belongs to a different web.
Identify the source and destination site URLs, a test document with multiple versions, and the accounts corresponding to its original author and editor. Confirm that the migration account can access the source and has sufficient permissions on the destination library.
Check destination users and document paths in the script
Use this approach to diagnose person-field updates and the reported invalid URL before continuing a custom migration.
Author and Editor are SharePoint person fields. Their lookup IDs refer to users in the destination site, so a source-site ID or a display-name match alone is not a reliable mapping.
Updating a list item's metadata does not by itself recreate the original version history or guarantee preservation of every version's author and dates.
In the destination SharePoint site, open Site permissions and confirm that the original users can be resolved in the target environment. Map source identities to destination accounts using a stable identifier such as a login name rather than display name alone.
In the PowerShell script, resolve each mapped account in the destination site and use the resulting destination user ID in a SharePoint CSOM FieldUserValue for the Author or Editor field. Verify that the migration account has permission to perform the update.
Before calling Get-PnPFile, check the active connection and print the file's full server-relative path, including the destination site and library. Confirm that the file exists in that web and that the path is handled consistently when the filename contains spaces.
Run the upload and metadata update on a test document, then open its library details and Version history menu to compare the author, editor, dates, and versions with the source.

Use a supported SharePoint migration tool
Use a migration tool when preserving metadata and version history is more important than maintaining a custom upload script.
Work with Migrated Documents in WPS Office
WPS Office is a free, lightweight Office alternative with a familiar interface and Microsoft Office format compatibility for a smooth transition. It can help you work with migrated files, but it does not migrate SharePoint libraries or repair their metadata.

Frequently Asked Questions
Why doesn't matching users by display name reliably preserve the author?
Display names can be duplicated or changed, and person-field IDs differ between sites. Map each source identity to a destination account, then resolve that account in the destination site before updating the field.
Does UpdateOverwriteVersion preserve all document versions?
No. It updates a list item without creating a normal new version, but it does not recreate a document's complete source version history. Use a supported migration tool or implement and validate version migration separately.
Why does Get-PnPFile report an invalid URL?
The path may be incomplete, point to another web, or refer to a file that was not uploaded where expected. Check the active destination connection and the full server-relative path, including the site and library.
Can I migrate without PnP PowerShell?
Yes. You can evaluate the SharePoint Migration Tool for a supported source, or develop against SharePoint APIs or CSOM instead. There is no single built-in PowerShell command that automatically preserves all authors, dates, and version history for every migration.




