A Word doc was changed by mistake in Sharepoint online.

I can go to the version history and restore older versions and delete other versions in the history.

However, I can't seem revert to the previous version so that it is identical to the state it was in, including the modified date and user.

Is there something that I am missing?

If not, is there a way to change it using admin settings or powershell or something else?


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.

  • I was expecting an option that worked in a similar way to git reset because I saw in the version history the option to delete prior versions just not the current version. Are you able to summarise the powershell info in your answer in case the link goes stale? – opticyclic Jan 30 at 20:34
  • Sure! Please, check the updated answer! – Mohamed El-Qassas MVP Jan 30 at 21:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.