Select Page

INTRANETS

SharePoint: Change the original First Published Date of a News Post

Sometimes you will need to be able to modify the FirstPublishedDate field in SharePoint Site Pages – this is how you do it.

SharePoint attribute stock images

SharePoint: Update original First Published Date of a News Post

The FirstPublishedDate field is a hidden field in SharePoint and difficult to modify.

I recently needed to update a handful of SharePoint News Posts. The News Posts had been created by copying existing posts and had kept the original FirstPublishedDate, which meant that the posts were being displayed in order based on the original date.

Here’s a script you can modify and use in order to modify the FirstPublishedDate field on those posts.

#This script modifies the FirstPublishedDate for a single item in the News-SitePages library.
#Update the script with your SharePoint $ClientID and SharePoint site URL, removing the < >
# Connect to the SharePoint site
$ClientId = "<enter your SharePoint $ClientID>"
$SPRootSite = "<enter your SharePoint site URL>"
Connect-PnPOnline -Url $SPRootSite -ClientId $ClientId -Interactive

# Prompt the user to enter the ID number of the news item to update
$newsItemId = Read-Host -Prompt "News item ID?"

# Prompt the user to enter the new publish date
$newpublishDate = Read-Host -Prompt "New publish date? (YYYY-MM-DD)"

# Get the news item
$NewsItem = Get-PnPListItem -List 'SitePages' -Id $newsItemId

# Update the news item with the new publish date
Set-PnPListItem -List 'SitePages' -Identity $newsItemId -Values @{'FirstPublishedDate' = $newpublishDate } -UpdateType SystemUpdate

SharePoint Modern online logo
Campbell Smythe

Campbell Smythe

Author

I am an intranet specialist working in SharePoint and other Microsoft 365 technologies. 

Recent articles

Was this post helpful?

If this post was helpful the best thing you can do to help us grow is to share it with your friends and colleagues.  Follow us on YouTube, Facebook, Instagram or X to see our new posts supporting intranet managers. 

SharePoint Modern online logo