It's normal behavior! when restoring an old version from the History list
, SharePoint updates the current item with the restored info!
Therefore, this action is considered as a new UPDATE on the current list item that happened now by the current user, and you will note that the Modified Date
field is set by default to the current date and time (The time of restoring
), and the Modified By
field is set to the current user name (the user who performs restore
).
As mentioned in this article, you can use PNP Powershell to SET the Modified (or Created) date on a List Item.
The first thing to note is that SharePoint treats everything as a list item even if it is a file.
In order to get the file/list id:
Install-Module SharePointPnPPowerShellOnline
Connect-PnPOnline "https://company.sharepoint.com/sites/Company"
Get-PnPFile -Url "/sites/Company/Shared Documents/Development/FontDemo.docx" -AsListItem
NOTE: The default Documents
library is Shared Documents
even though the browser just shows Documents
Once you have the id you can update the file:
Set-PnPListItem -List Documents -Identity 135 -Values @{"Modified"="2020-05-08T04:56-05:00";"Editor"="my.user@company.com";}
NOTE: in this case we are using Documents
as that is the name of the list, even though the library path is Shared Documents
.