p.WasPublished vs ThatArePublished()

Posted by Community Admin on 04-Aug-2018 12:02

p.WasPublished vs ThatArePublished()

All Replies

Posted by Community Admin on 22-Aug-2012 00:00

Hi there.
Could someone explain the difference between the following 2 Fluent API methods?

App.WorkWith().
Pages().
LocatedIn(Telerik.Sitefinity.Fluent.Pages.PageLocation.Frontend).
Where(p => p.WasPublished == true).
Get().
ToList();
and
App.WorkWith().
Pages().
LocatedIn(Telerik.Sitefinity.Fluent.Pages.PageLocation.Frontend).
ThatArePublished().
Get().
ToList();

Posted by Community Admin on 24-Aug-2012 00:00

Hi,

WasPublished is property of the PageNode object. ThatArePublished is part of PagesFacade.
ThatArePublished has an overload that allows you to pass the culture, so the method will filter by it.
ThatArePublished filters by two parameters - all page nodes that are visible and their version is greater that 0.

The property does not allow you to specify culture and it does not checks for visibility.

Kind regards,
Ivan Dimitrov
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 25-Aug-2012 00:00

Thanks Yvan.
Makes sense now:)

Posted by Community Admin on 11-Sep-2012 00:00

Hi,

did you change the behaviour of ThatArePublished() from version 4.4 to 5.1?

This used to work in 4.4:

App.WorkWith().Pages().LocatedIn(Telerik.Sitefinity.Fluent.Pages.PageLocation.Frontend).ThatArePublished(Thread.CurrentThread.CurrentCulture).Where(p => p.ShowInNavigation == true).OrderBy(p => p.Ordinal).Get()

but doesn't return any pages in 5.1. So i have to use:
App.WorkWith().Pages().LocatedIn(Telerik.Sitefinity.Fluent.Pages.PageLocation.Frontend).ThatAreForLanguage(Thread.CurrentThread.CurrentCulture).Where(p => (p.ApprovalWorkflowState == "Published" || p.ApprovalWorkflowState == "") && p.ShowInNavigation == true).OrderBy(p => p.Ordinal).Get();


Thanks
Matthias

This thread is closed