SharePoint 2016 Logo

Sometimes you need to make some not common things with data in SharePoint site. Today one girl asked me if I can modify date of creation or modification date of a file in document library. Of course, there can be other cases, for example, you need to save creation date information for data in migration process.

You can modify information aboout date of creation, modification and even author. In this snippet you will find the information about how to update date modified and date created for SharePoint item using PowerShell.


#Update date modified and date created for SharePoint items
#Add SharePoint PowerShell SnapIn if not already added
if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null) {
    Add-PSSnapin "Microsoft.SharePoint.PowerShell"

#Configuration parameters
$WebURL="https://sp10/sites/products/ "
$spweb = Get-SPWeb $WebURL
$doclib = $spweb.Lists[$ListName]
$item = $doclib.GetItemById(43)

$item["Created"] = '2019-02-12Z12:14:51'
$item["Modified"]= '2019-02-12Z12:14:51'


Yandex.RTB R-A-454402-1