Share via

SharePoint New Posts - date is incorrect therefore places it not at the top of pages to display

Anonymous
2024-03-14T05:38:23+00:00

I am fairly new to SharePoint pages. I have been making informative posts for the team and sending them as emails, but also displaying them as news items. The one that I have just sent out does not appear at the top though on the main page, because the date is listed as January 1, 1 (where as it should read March 14, 2024!):

last posted item still shows at the top on the main page (dated March 6, 2024):

Microsoft 365 and Office | SharePoint | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

9 answers

Sort by: Most helpful
  1. matt howell 3,511 Reputation points
    2024-03-18T13:07:25+00:00

    This is what I use-save this as a ps1 file like "update.ps1":

    #Parameters & formats # $_AuthorByline = iNumber@xxx or name,$FirstPublishedDate = "2019-11-27T10:30:00-00:00" ,$Modified = "2019-11-27T10:30:00-00:00"   
    $SiteURL= "https://xxx.sharepoint.com/sites/yoursitename" 
    $ListName = "SitePages"  
    $ItemID = "413"    
    $FirstPublishedDate = "2023-12-28T12:00:00-00:00"       
    #Connect to PnP Online Connect-PnPOnline -Url 
    $SiteURL -UseWebLogin   Set-PnPListItem -List 
    $ListName -Identity 
    $ItemID -Values @{"FirstPublishedDate"=$FirstPublishedDate}  
    

    Then open the Sharepoint management shell (download it if you don't have it). Navigate to the directory you saved the ps1 file in and enter:

    .\update.ps1 (change file name obviously to whatever you saved the file as)

    You'll probably get a prompt to log in as a site admin (r maybe even a SP admin)

    If you get an error about commands not existing you need to install the PnP library-read about it here: https://www.sharepointdiary.com/2021/02/how-to-install-pnp-powershell-module-for-sharepoint-online.html

    This way the next time it happens (and it will) you can just change the site url, page id and date in the file and run it again. We also use this to update other read only fields, like created date, created by (which is default author) Etc.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2024-03-18T04:03:58+00:00

    I appreciate your reply! I am trying this with no luck.... any advice? Sorry to ask!! I have tried for the date 2024-03-14 also as I was unsure which way it should read, but it doesn't seem to matter.

    $publishDate = '2024-14-03'

    Set the ID of the news item to update

    $newsItemId = 20

    Connect to the SharePoint site using PnP-PowerShell

    Connect-PnPOnline "https://OURSHAREPOINTADDRESS" -ClientId $AppID -Interactive

    Get the news item in English

    $englishNewsItem = Get-PnPListItem -List 'SitePages' -Id $newsItemId

    Update the news item with the new publish date

    Set-PnPListItem -List 'SitePages' -Identity $newsItemId -Values @{'FirstPublishedDate' = $publishDate } -UpdateType SystemUpdate

    if ($englishNewsItem.FieldValues._SPTranslatedLanguages) {

        # If there are translations, get the UniqueId of the English news item

        $uniqueId = $englishNewsItem.FieldValues.UniqueId

        # Get the translated news items

        $translatedNewsItems = Get-PnPListItem -List 'SitePages' -Query "<View Scope='RecursiveAll'><Query><Where><Contains><FieldRef Name='_SPTranslationSourceItemId'/><Value Type='Guid'>$($uniqueId)</Value></Contains></Where></Query></View>"

        # Update each translated news item

        foreach ($translatedNewsItem in $translatedNewsItems) {

            Set-PnPListItem -List 'SitePages' -Identity $translatedNewsItem.Id -Values @{'FirstPublishedDate' = $publishDate } -UpdateType SystemUpdate

        }

    }

    I found this on some help online, have tried also running without the translated pages part, as there are none for us.

    Was this answer helpful?

    0 comments No comments
  3. matt howell 3,511 Reputation points
    2024-03-16T01:13:03+00:00

    Yeah this is a bug that's been reported to Msft MANY times yet never addressed. At random times, the "first published date' doesn't get updated correctly and it's a read only field you can't edit. What we do when this happens is run a small powershell script to correct the date. As a workaround, you can manually arrange the order from the web part properties but this obviously is not a good way of doing things. Perhaps someday Msft will take pity on us, and actually fix this years old bug but I"m not holding my breath, based on their past complete lack of respect for their customers..

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2024-03-15T07:05:08+00:00

    Dear Admin

    Good day!!

    Apologies for the inconvenience caused and please don’t worry, let’s work together on your concern and move towards a resolution path.

    I understand your concern and, in my opinion, the behavior you are observing is not an expected behavior because the the news post created in the SharePoint Online site has published with the wrong date and to check whether the same issue happens at my end, I have tested the behavior in my test tenant, where I can’t reproduce any problem.

    I believe the problem should be further investigated by related development team via collecting HAR logs because there is not any related service incident reported at the Microsoft Service Health dashboard.

    I do feel regret for not resolving the problem and redirecting you to the related development team but the fix to your concern can be find out through the HAR logs and suggest you raise a support ticket from the Office 365 admin center, where the related team will investigate the problem further by collecting the HAR logs.

    Reference: Get support - Microsoft 365 admin | Microsoft Learn

    Appreciate your patience and understanding. Have a great day!!

    Best Regards,

    Sophia

    Thanks for your reply. Unfortunately I (along with everyone in the organisation) am not an admin so I cannot submit a support ticket via the means you have suggested. Our IT company manage user accounts for us, hence we do not have this admin access account. Is there another way that I can gain MS support about this issue?

    Was this answer helpful?

    0 comments No comments
  5. Anonymous
    2024-03-14T08:38:01+00:00

    Dear Admin

    Good day!!

    Apologies for the inconvenience caused and please don’t worry, let’s work together on your concern and move towards a resolution path.

    I understand your concern and, in my opinion, the behavior you are observing is not an expected behavior because the the news post created in the SharePoint Online site has published with the wrong date and to check whether the same issue happens at my end, I have tested the behavior in my test tenant, where I can’t reproduce any problem.

    I believe the problem should be further investigated by related development team via collecting HAR logs because there is not any related service incident reported at the Microsoft Service Health dashboard.

    I do feel regret for not resolving the problem and redirecting you to the related development team but the fix to your concern can be find out through the HAR logs and suggest you raise a support ticket from the Office 365 admin center, where the related team will investigate the problem further by collecting the HAR logs.

    Reference: Get support - Microsoft 365 admin | Microsoft Learn

    Appreciate your patience and understanding. Have a great day!!

    Best Regards,

    Sophia

    Was this answer helpful?

    0 comments No comments