Using App.WorkWith to get blogPosts
I'm attempting to get blogPosts... this part works. I attempt to get blog posts that are published... this also works. But then I attempt to get blogPosts and exclude posts that are expired, and this fails. The only way i can get posts that are published and not expired is to use the 'unpublish' setting for a post. I checked the database and there are 2 fields for expiredDate. Also, I was going to get posts that are before an unpublished date but there is no method for this.
var blogList = App.WorkWith().Blog(blogId).BlogPosts()
.Where(b => b.Status == ContentLifecycleStatus.Live && b.PublicationDate <= dateTimeNow && (b.ExpirationDate >= dateTimeNow || b.ExpirationDate.Equals(null)))
.Get().ToList();
or
var posts = from p in App.WorkWith().BlogPosts()
where p.Parent.Title == "Testing"
&& (p.ExpirationDate >= dateTimeNow || p.ExpirationDate == null)
orderby p.Title
select p;
Is the WorkWith fluent method properly wired to use expired field? I'm asking because I can't seem to find an unpublished attribute.
Hi Richard,
Can you please try to use the Published() filter available for the fluent API, for example:
App.WorkWith().BlogPosts().Published().Get();