Fluent api returning blog posts in draft status?

Posted by Community Admin on 04-Aug-2018 06:38

Fluent api returning blog posts in draft status?

All Replies

Posted by Community Admin on 21-Nov-2012 00:00

using (var fluent = App.WorkWith())
 
            var list = fluent.BlogPosts()
                            .Where(b => b.Status == ContentLifecycleStatus.Live)
                            .Get().Take(5);
I'm using the following to return blog posts but posts that are still in draft status are being included. Is this a bug or am I not querying them correctly?

Posted by Community Admin on 21-Nov-2012 00:00

Hello Jeff,

Can you try to set the .Visible attribute to true as well, so that the blog posts can be properly filtered - if you set the Visible attribute to true, you will notify the system to take items that are publicly visible. For example:

var BlogPosts = App.WorkWith().BlogPosts().Where(p => p.Parent.Title == "blog2" && p.Status == ContentLifecycleStatus.Live && p.Visible == true).Get().ToList();

The following query will return all published blog posts that are in the Blog called blog2. You can check the attached screenshot as well.

All the best,
Victor Velev
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 21-Nov-2012 00:00

Thanks. That worked.

This thread is closed