How To Update News Publication Date?

Posted by Community Admin on 03-Aug-2018 09:14

How To Update News Publication Date?

All Replies

Posted by Community Admin on 16-Sep-2011 00:00

Hi Everyone!

Can you please tell me how can I modify the publication date of the news items?
I allowed the PublishDate to visible from custom field options and it is displaying on the edit mode of news but when I update the publish date it does not update.I am using sitefinity 4.1 SP3.
Can you please reply ASAP.

Thanks!

Posted by Community Admin on 17-Sep-2011 00:00

Hi Waqar,

Try this extension method:

public static void SetPublicationDate(this Content item, IContentLifecycleManager manager, DateTime publicationDate)
    var liveItem = manager.GetLive(item);
    liveItem.PublicationDate = publicationDate;
 
    var masterItem = manager.GetMaster(item);
    masterItem.PublicationDate = publicationDate;

And then after you call the Publish method of the content manager call

((Content)newsItem).SetPublicationDate(manager, publicationDate);
manager.SaveChanges();

All the best,
Lubomir Velkov
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 08-Nov-2011 00:00

Lubomir,
Could I get some more information on this solution?

The code you've provided; do we add this to the code-behind on the page the news widget in included?

Just how do I implement this?

Kevin

Posted by Community Admin on 10-Nov-2011 00:00

Hello Kevin,

This code is used to manually update the Publication date. If you want a solution that allows you to modify it from the Backend then this is not going to work.

All the best,
Lubomir Velkov
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed