1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / p.WasPublished vs ThatArePublished()

p.WasPublished vs ThatArePublished()

4 posts, 1 answered
  1. Olivier
    Olivier avatar
    31 posts
    Registered:
    06 Aug 2012
    22 Aug 2012
    Link to this post
    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();
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    24 Aug 2012
    Link to this post
    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
    Answered
  3. Olivier
    Olivier avatar
    31 posts
    Registered:
    06 Aug 2012
    25 Aug 2012
    Link to this post
    Thanks Yvan.
    Makes sense now:)
  4. Matthias
    Matthias avatar
    10 posts
    Registered:
    30 Jul 2009
    11 Sep 2012
    Link to this post
    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
4 posts, 1 answered