Please tell me if there is something wrong with this line of code:
var pages = App.WorkWith().Pages().ThatArePublished().Where(p => p.GetPageData().Visible).Get().ToList();
I am trying to get all visible pages, because I believe the .ThatArePublished() method in my version of Sitefinity doesn't work correctly, as it is pulling in pages that are not published. This is a work around I discovered on these forums, but am having trouble implementing it.
Am I doing something wrong here? All my function does is return the page variable, and parses it from there. I have it tracked down to this very line of code. Any help would be greatly appreciated! Thank you.
Give up on the fluent api and just use the mangers. Fluent just wraps them anyway and leaves out too many things.
Filter on staus live and visible true
Steve is absolutely right.
But if u still want to use fluent, you can try this code. It's taking published, filtering by language and not deleted:
var newCulture = new CultureInfo("en");
var pagesFl = App.WorkWith().Pages()
.Where(p => p.IsDeleted == false)
.OrderByDescending(x => x.LastModified).ToList();