Is it possible to get the scheduled publish/unpublish date/time which has been configured for a given node programmatically? The support chatbot suggested that I make use of an IContentService to get a node by its ID and then obtain it via a ContentSchedule field on the content item returned, but this doesn’t appear to be part of the API for v16. The suggested code was as follows:
var contentService = Services.ContentService;
var content = contentService.GetById(contentId);
var unpublishAction = content.ContentSchedule
.FirstOrDefault(x => x.Action == ContentScheduleAction.Unpublish);
if (unpublishAction != null)
{
var unpublishDate = unpublishAction.Date;
// use unpublishDate as needed
}
However, when I make use of contentService.GetById, the IContent being returned does not have a ContentSchedule field. Is the chatbot correct and I am doing something wrong, or is the chatbot using outdated sources?