1

I am trying to move some publishing pages from an old SharePoint server to a new one using powershell. When I try to update the createdDate it says the property is read only. Is there a way to change createdDate and modified date for a publishing page using powershell?

1
  • So basically you are creating new list items, but with the same file? Are you referring to the field "Created"? Commented Nov 27, 2013 at 14:21

2 Answers 2

1

If you have minor versioning enabled on the list, you can try to switch it of during the update.

$list.EnableMinorVersions = $false
$list.Update()

// Update items
$aListItem["Created"] = yourNewDate
$aListItem.UpdateOverwriteVersion()

// When done, enable minor versions again
$list.EnableMinorVersions = $true
$list.Update()
1
  • I used your code in my powershell but the modified date is exacat the date the powershell created the page. here is my code inside the page layout: <SharePointWebControls:FormField ID="FormField2" ControlMode="Display" FieldName="Modified" DisableInputFieldLabel="true" runat="server"/>
    – Medes
    Commented Nov 28, 2013 at 9:06
0

Try to get list item(page) and update "Created" field:

$item["Created"] = Get-Date "5/1/2006 7:00 AM"
$item.Update()

Another option might be to create your custom field and copy data to it.

1
  • I used your code but it casts an exception and says something like invalid cast. my date is yyyy-mm-dd.
    – Medes
    Commented Nov 28, 2013 at 9:07

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.