How to Fix Migrated Files Lose Created By Metadata
🔍 WiseChecker

How to Fix Migrated Files Lose Created By Metadata

When you migrate files into SharePoint, the Created By field often shows the migration account instead of the original author. This happens because SharePoint writes the account that performed the upload as the creator. This article explains why the metadata is lost and provides two methods to restore the original Created By values.

Key Takeaways: Restoring Created By Metadata After Migration

  • SharePoint Site Collection Feature: Enable Document IDs: Assigns a permanent ID to each file, which helps preserve metadata during migrations.
  • SharePoint Migration Tool (SPMT) Settings: You must enable the “Preserve user identity” option to keep original Created By values.
  • PowerShell script Set-PnPListItem: Updates the Created By field (Author) for individual files after migration.

ADVERTISEMENT

Why Migrated Files Lose the Original Created By Metadata

SharePoint stores the Created By value in the Author field of a list item or library file. When you upload a file through the web interface, the SharePoint Migration Tool, or a third-party tool, SharePoint sets the Author to the account that performed the upload. The migration tool does not carry over the original author information unless you configure it specifically.

The root cause is that SharePoint treats each file upload as a new creation event. The file system metadata from the source (like Windows file properties) is not mapped to the SharePoint Author field by default. The migration tool reads the file but does not write the original author into the Author column unless you enable a special setting.

Additionally, if you move files between SharePoint libraries using the Move To or Copy To commands, the Created By field resets to the account performing the move. This is by design to maintain an audit trail of who placed the file in the new location.

Method 1: Configure the SharePoint Migration Tool to Preserve Created By

The SharePoint Migration Tool (SPMT) can preserve the original Created By value if you enable the correct option before running the migration. This method works for OneDrive and SharePoint migrations.

  1. Open the SharePoint Migration Tool
    Download and install SPMT from the Microsoft 365 admin center if you have not done so. Launch the tool and sign in with a SharePoint admin account.
  2. Create a new migration task
    Click Start and select File shares or SharePoint Server as the source type. Enter the source path and destination SharePoint site URL.
  3. Open advanced settings
    On the Choose settings page, click Advanced settings to expand the options.
  4. Enable Preserve user identity
    Under User mapping, toggle the switch for Preserve user identity to On. This setting tells SPMT to map the original file owner to the SharePoint Author field.
  5. Run the migration
    Click Start to begin the migration. After completion, verify the Created By column in the destination library shows the original author names.

If you already migrated files without this setting, you cannot re-run the migration to fix the metadata. You must use the PowerShell method below.

ADVERTISEMENT

Method 2: Use PowerShell to Update the Created By Field

If the migration is complete and the Created By field is wrong, you can correct it with a PowerShell script. This method requires the SharePoint PnP PowerShell module.

  1. Install the PnP PowerShell module
    Open PowerShell as an administrator and run: Install-Module -Name PnP.PowerShell -Force. Close and reopen PowerShell after installation.
  2. Connect to your SharePoint site
    Run: Connect-PnPOnline -Url "https://yourtenant.sharepoint.com/sites/yoursite" -Interactive. Sign in with a SharePoint admin account.
  3. Get the current file item and user
    Run the following commands to store the file and the target user in variables:
    $file = Get-PnPListItem -List "Documents" -Id 1
    $user = Get-PnPUser -LoginName "user@domain.com"

    Replace Documents with your library name, Id 1 with the list item ID, and the login name with the original author.

  4. Set the Author field
    Run: Set-PnPListItem -List "Documents" -Identity $file -Values @{"Author" = $user}. This command updates the Created By field for that single file.
  5. Repeat for additional files
    Create a loop to process multiple files. Example:
    $items = Get-PnPListItem -List "Documents" -PageSize 500
    foreach ($item in $items) {
        $user = Get-PnPUser -LoginName "originalauthor@domain.com"
        Set-PnPListItem -List "Documents" -Identity $item -Values @{"Author" = $user}
    }

    This script updates every item in the library to the same author. Adjust the login name per file if needed.

Note that the Author field is read-only in the SharePoint web interface. You cannot edit it manually from the list settings or the item properties pane.

Common Issues When Restoring Created By Metadata

SharePoint Migration Tool Shows Preserve User Identity as Grayed Out

The Preserve user identity option is only available when migrating from SharePoint Server or file shares. It is not available for other source types like Google Drive or Box. If the option is grayed out, you must use the PowerShell method to update the metadata after migration.

PowerShell Returns an Error That the Author Field Is Invalid

The Author field expects a user object, not a string. Always use Get-PnPUser to retrieve the user object and pass it to the -Values parameter. If the user does not exist in the SharePoint site, you must add them first using Add-PnPUser.

Created By Resets After a File Move or Copy

When you move or copy a file within SharePoint, the Created By field changes to the account that performed the move. To preserve the original author, use the Move to command with the option Keep file version history enabled. This option carries over the Author field from the source location.

SharePoint Migration Methods: Created By Preservation Comparison

Item SPMT with Preserve User Identity PowerShell Set-PnPListItem
Description Migration tool setting that maps original file owner to Author field Script that updates the Author field for existing items
When to use Before migration starts After migration is complete
Requires admin permissions Yes, SharePoint admin Yes, site owner or admin
Supports bulk operations Yes, for the entire migration Yes, with a loop script
Works for all file types Yes Yes

You can now restore the Created By metadata for migrated files by enabling the Preserve user identity setting in SPMT before migration or by running a PowerShell script after migration. For future migrations, always enable the Preserve user identity option to avoid the problem entirely. As an advanced tip, use the SharePoint Document ID feature to assign a permanent ID to each file, which helps link files to their original authors even after moves or copies.

ADVERTISEMENT