How To Update News Publication Date?
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!
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;
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
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,