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?

  • So basically you are creating new list items, but with the same file? Are you referring to the field "Created"? – Robert Lindgren Nov 27 '13 at 14:21
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()
  • 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 Nov 28 '13 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.

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

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.