Forum Discussion
grant_jenkins
Sep 30, 2022Steel 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
I just ran into this same problem. I had a large news post from a couple of years ago. I created a copy of it because I wanted to send out a reminder email about one piece of it. I edited the new post by deleting the content I didn't need anymore. Then published it as a new news post. However, the first published date is still showing the old date so the news post isn't showing up on the Hub or Team site unless I scroll all the way back to the original year source article was posted.
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
}
- micahwilliJul 03, 2023Copper ContributorWe have to do all this to enable what every. other. blog platform already does out of the box?