Forum Discussion
grant_jenkins
Sep 30, 2022Iron Contributor
Change Published Date for News Post
We are converting some old announcements to News Posts and need to ensure that the Published Date is the same as what they were before. We can use PowerShell to change the First Published Date wh...
NThoman
May 09, 2023Iron Contributor
Update! Just found this post.
https://babakdanyal.com/edit-original-publishing-date-in-sharepoint-news-posts/
#start region
#
# Editable Published Date OR First Published Date - Use this script to update the original published date of news articles in the SharePoint site.
#
#end region
$SiteURL = "<site url goes here>"
$ListName= "Site Pages"
$Date = "2019-12-20"
$NewsID = 10
Connect-PnPOnline -Url $SiteURL -Interactive
if (-not (Get-PnPContext)) {
Write-Host "Error connecting to SharePoint Online, unable to establish context" -foregroundcolor black -backgroundcolor Red
return
}
else{
Set-PnPListItem -List $ListName -Identity $NewsID -Values @{"FirstPublishedDate"=$Date;} -UpdateType SystemUpdate
}
https://babakdanyal.com/edit-original-publishing-date-in-sharepoint-news-posts/
#start region
#
# Editable Published Date OR First Published Date - Use this script to update the original published date of news articles in the SharePoint site.
#
#end region
$SiteURL = "<site url goes here>"
$ListName= "Site Pages"
$Date = "2019-12-20"
$NewsID = 10
Connect-PnPOnline -Url $SiteURL -Interactive
if (-not (Get-PnPContext)) {
Write-Host "Error connecting to SharePoint Online, unable to establish context" -foregroundcolor black -backgroundcolor Red
return
}
else{
Set-PnPListItem -List $ListName -Identity $NewsID -Values @{"FirstPublishedDate"=$Date;} -UpdateType SystemUpdate
}
micahwilli
Jul 03, 2023Copper Contributor
We have to do all this to enable what every. other. blog platform already does out of the box?