0

I'm trying to get modified date from version history by PowerShell, with Sharepoint Online. Using PnP, I did

$Ctx = Get-PnPContext
$Item = Get-PnPListItem -List "Documents" -Id xxxxx
$File = $Item.File
$Versions = $File.Versions
$Ctx.Load($File)
$Ctx.Load($Versions)
$Ctx.ExecuteQuery()
$LastVersion = $Versions[$Versions.Count-1] # previous version

I supposed that $LastVersion.Created was Modifed Date of that version, but it's not the date displayed as "Modified Date" of OneDrive's version history which is correct.

Could anyone help to get the correct modified date of such old version?

1
  • The difference is not from the TimeZone. For example, Version History of OneDrive Web page shows "12/11/2013 03:01AM" but $LastVersion.Created says "2020/11/16 03:27PM"
    – Jose
    Feb 8, 2022 at 0:32

1 Answer 1

0

SharePoint stores dates in UTC, dates are converted according to the sites regional settings and then displayed. The date returned by your PowerShell is in UTC, which is likely why it is appears different to the displayed date in OneDrive but is in fact correct.

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.