I created a custom module using the module builder. I am trying to search for all of the published items for its type. The problem is that the ExpirationDate is always null. Here is the code I use to retrieve the items:
var query = " Visible = true AND Status = Live AND PublicationDate <= DateTime.UtcNow AND (!ExpirationDate.HasValue OR ExpirationDate > DateTime.UtcNow) ";
var items = App.WorkWith().AnyContentItem(type).Manager.GetItems(type, query, string.Empty, 0, 0);
I generated the type with TypeResolutionService.ResolveType(...); Items come back but their ExpirationDate is null. Items that have an expiration date before the current date also come back and I don't want them too.
Posted by Community Admin on 21-Jun-2012 00:00
As mentioned in the other forum thread on a similar topic, the ExpirationDate property will be set to a certain value when the item is scheduled for Unpublish. However you can handle this in the filter as well. Please find below the default implementation for the Published() fluent filter:
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