Sharepoint News post display incorrect Created Date from the site page.

kem104 145 Reputation points
2024-08-15T18:22:57.8233333+00:00

Hi I have successfully copied the news post from one site to another. In the targeted site, Site page library created date is also transferred successfully using the "Send an HTTP request to SharePoint" . Now the created date is same as sources and target site.

I also have issue with displaying webpart correctly and I get help from the following
Q & A.

https://learn.microsoft.com/en-us/answers/questions/1862121/news-post-page-does-not-appear-after-it-copied-fro

I configured my New webpart with "This Site" setting. The issue is, news post created date saying January 1, 1 even if the backend created date from the Site pages library is March 2023. Do not understand , when Site page library has correct date but when same post display on the News post the date convert to January 1.

for your reference, the screenshot below is from News webpart.

User's image

This screenshot is from Site Pages LibraryUser's image

Thank you so much for your response in advance.

Cheers

SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
3,026 questions
0 comments No comments
{count} votes

Accepted answer
  1. Ling Zhou_MSFT 18,095 Reputation points Microsoft Vendor
    2024-08-16T06:23:13.73+00:00

    Hi @kem104,

    Thank you for posting in this community.

    First of all, date in News web part is not the date when your news was created, but the time when your news was first published. As in the screenshot you shared with me in the previous question, the option is to show when it was first published.

    User's image

    Your case is by chance, because I tested and the first published date of the copied page should be the same. The first published date is an internal property of the page, so I got the first publish date for both news via PowerShell. You can see that in the 24Jun and 24AugCom, the first published date is same.

    User's image

    While I haven't been able to reproduce your problem, here are some things we can do to narrow down the cause of the problem.

    1.Check the first published date of the news:

    Start by installing the PnP module for SharePoint Online, and then run the following PowerShell command to see if there is an issue with first published date of the news.

    Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link. 

    #Connect to the site,please replace your site	
    Connect-PnPOnline -Url "https://yourtenant.sharepoint.com/sites/sitename" -Interactive
    # Get the page,please replace your page
    $pageUrl = "/sites/sitename/SitePages/pagename.aspx"
    $page = Get-PnPFile -Url $pageUrl -AsListItem
    # Get the first published date
    $firstPublishedDate = $page["FirstPublishedDate"]
    Write-Output "First Published Date: $firstPublishedDate"
    

    If there is a problem with the date, you can make the following command to modify the date.

    Connect-PnPOnline "https://tenant.sharepoint.com/sites/sitename" -Interactive
    # Set your new publish date
    $publishDate = '07/12/2014 00:00:00'
    # Set the ID of the news item to update
    #you can get edit site pages library's view and get the id from ID column
    $newsItemId = 15
    Set-PnPListItem -List 'SitePages' -Identity $newsItemId -Values @{'FirstPublishedDate' = $publishDate } -UpdateType SystemUpdate
    

    2.Recreate the News Web part and see if the issue persists.

    3.Try to use a different browser or your browser's InPrivate mode to see if the news occurs.

    4.Check if the same issue occurs with other SharePoint sites.

    5.Are other users facing the same problem? View through another computer or account.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


1 additional answer

Sort by: Most helpful
  1. Q&A Assist
    2024-08-15T18:22:57.8433333+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    The modified date on the SharePoint site contents page may not accurately reflect the date of the last change made by users to objects such as lists, libraries, and sites. This is because the modified date on the site contents page reflects the value stored in the ItemLastModifiedDate property of the object, which may also be updated by system events. However, the modified date on the site contents page has been modified in SharePoint 2019 and SharePoint Online by introducing a new attribute (LastItemUserModifiedDate) to track changes that are the result of user events. Items on the site contents page now reflect the value of this property.

    It is possible that the News web part is displaying the incorrect created date for news posts because it is using the ItemLastModifiedDate property instead of the LastItemUserModifiedDate property. You may want to check if the News web part is using the correct property to display the created date.

    Additionally, it is worth noting that the News web part provides controls to choose the News Source and Layout, and to Organize and Filter the content. Under Layout, there are five options to adjust how news items are presented. You may want to check if the News web part is configured correctly to display the created date.


    References:

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.