0

Last weekend we copied (using drag and drop from file explorer into the SharePoint web UI) about 100k documents from a locally hosted file server to SharePoint online.

We made fundamental changes to the directory structure as part of the project. SharePoint is not an exact mirror of what is in the file server. It would be like having Lego's organized and stored in containers by shape, and then deciding to store them by color instead in the new environment.

All of the files show the modified date as the date we copied them into SharePoint online.

The company has been making changes to the documents this week as part of their normal workflow.

We have just been informed that having the correct modified date on the files from the original file server is critical to their workflow.

Is this possible?

1 Answer 1

1

It is possible but the modified date must be set programmatically. Normally, migrations like this are done using migration software such as ShareGate. ShareGate would migrate the content from the file drive and set the modified dates using either SharePoint or Graph APIs.

You could set the created and modified dates using PowerShell, here is an example using PnP.PowerShell:

#Parameters
$SiteURL = "https://crescent.sharepoint.com/sites/branding"
$ListName = "Brand"
$SiteRelativeURL = "/Brand/Technical Design.docx"
$CreatedBy= "[email protected]"
$Title = "New Design Document V2.docx"
  
#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -Interactive
   
#Get the File from SharePoint
$File = Get-PnPFile -Url $SiteRelativeURL -AsListItem
   
#Update document properties
Set-PnPListItem -List $ListName -Identity $File.Id -Values @{"Title" = $Title; "Author" = $CreatedBy; "Editor" = $CreatedBy}

SharePoint Online: Update Created By / Modified By, Created / Modified Field Values using PowerShell

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.