How to keep Created, Modified and authors in a cross-tenant SharePoint migration
Why copied files show today's date and the migration account as author, which four fields fix it, and the traps around people, folders and Teams channels.
You copy a document library from one Microsoft 365 tenant to another, open the target, and every file says Modified: a few minutes ago, by Migration Admin. Nothing is lost, technically. In practice, people can no longer sort by date, find "the version Anna sent last spring", or see who owns what. For many users that is the moment the migration feels broken.
This article explains why it happens, what has to be set to fix it, and the cases that catch people out.
Why copied files lose their dates and authors
SharePoint records four values for every file and folder:
| Field | Shown as | Set automatically to |
|---|---|---|
Created | Created | The moment the item is created in this library |
Modified | Modified | The moment of the last change |
Author | Created By | The account that created it |
Editor | Modified By | The account that changed it last |
When you upload a file into the target tenant, whether through the browser, the OneDrive sync client or a script, the target library sees a brand-new file. So it fills in all four fields with now and the account doing the upload. The values from the source tenant are not carried along with the file contents; they live in the source library's list item.
To keep them, the migration has to read the four values in the source and write them back onto the target item after the upload.
Writing the values back without creating a new version
The obvious approach, uploading the file and then updating its fields, has a catch: a normal update is itself a change. It sets Modified to now and Editor to you again, and in a library with versioning it adds a version.
SharePoint has an update mode for exactly this case. In CSOM it is UpdateOverwriteVersion(); in PnP.PowerShell it is -UpdateType UpdateOverwriteVersion. It writes the fields you give it onto the current version, without adding a new one and without stamping your own name and time over them:
Set-PnPListItem -List "Documents" -Identity 42 -UpdateType UpdateOverwriteVersion -Values @{
Created = "2021-03-04 09:15"
Modified = "2023-07-19 16:40"
Author = "anna@target.com"
Editor = "mark@target.com"
}
Two details matter here:
- Time zones. Read and write the dates as UTC, or in the same time zone on both sides. Otherwise every file shifts by a few hours, which is enough to confuse anyone comparing dates.
- Order. Set the fields as the last step for each file. Anything that touches the item afterwards, such as setting other columns, can overwrite them again.
The hard part: people in another tenant
Created and Modified are just dates. Author and Editor are people, and the people in the source tenant don't exist in the target tenant. anna@contoso.com in the source is, at best, anna@fabrikam.com in the target, and only if someone created that account.
So every person value needs a translation:
- Build a people map from source to target accounts. Usually that means matching on email address after the domain change, with manual fixes for name changes and shared accounts.
- Make sure the target account is known to the site. SharePoint stores people per site, so the account has to be added to the site's user list (
EnsureUserin CSOM) before it can be used as an author. - Decide what happens to people who can't be matched: leavers, external guests, service accounts. A common choice is to keep the dates and leave the person as the migration account, and to list those files in the migration report so nobody is surprised later.
Doing this mapping before copying anything is the single best way to avoid a second pass over thousands of files.
Folders need their own pass
Folders have the same four fields, and they suffer from the same problem twice over: a folder is created at the start of the copy, and then files are added to it. If you stamp the folder's dates first, the uploads that follow can make it look recently changed again.
The reliable order is:
- Create the folder structure.
- Copy the files and set their fields.
- Then set the folder fields, deepest folders first.
Folders are also cheap to batch: setting the fields on 50 folders in one request is much faster than 50 separate requests.
Teams channel folders are off limits
In a team's document library, every standard channel has its own top-level folder: General, Projects, and so on. SharePoint protects these folders, because Teams manages them. Trying to change their fields fails with an error along the lines of "To update this folder, go to the channel in Microsoft Teams".
That's expected and harmless. Skip those folders, and don't report them as failures, otherwise every Teams site in your report looks like it has problems.
Version history
Most file-copy approaches move the current version of each file. The original's older versions stay in the source tenant. If version history matters for some libraries, for example contracts or controlled documents, agree on that before the migration: either keep the source available read-only for a while, or plan a tool and a timeline that copies versions too. Copying versions multiplies both the data volume and the time needed.
How to check the result
Don't rely on spot checks in the browser alone. A quick comparison of a few hundred items per library catches most problems:
Get-PnPListItem -List "Documents" -PageSize 500 -Fields FileRef, Created, Modified, Author, Editor |
Select-Object @{n='Path';e={$_.FieldValues.FileRef}},
@{n='Created';e={$_.FieldValues.Created}},
@{n='Modified';e={$_.FieldValues.Modified}},
@{n='CreatedBy';e={$_.FieldValues.Author.Email}},
@{n='ModifiedBy';e={$_.FieldValues.Editor.Email}} |
Export-Csv target-metadata.csv -NoTypeInformation
Run the same against the source library, then compare the two files by path. Look for three things: dates that differ by whole hours (time zone), people that are all the same account (mapping failed), and folders showing the migration date (folder pass missing).
Checklist
- Map source people to target accounts before copying anything.
- Upload each file, then set
Created,Modified,AuthorandEditorwith an overwrite-version update. - Handle dates in UTC on both sides.
- Stamp folders after their files, deepest first; skip Teams channel folders.
- List every file whose people could not be mapped.
- Compare source and target metadata for each library before you sign off.
CrossTenant Pro does all of the above as part of every copy, including the people map, folder pass and the report of anything it couldn't apply. If you'd rather script it yourself, the approach above works the same way with PnP.PowerShell.