Need fluent API queries - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

Need fluent API queries

  • Need fluent API queries
  • Hello,

    Can someone please send me the fluent API queries for the following?

    1. To retrieve the list of ALL the pages in the website (Non backend pages).
    2. To retrieve the list of All the Blogs in the website.
    3. To retrieve the list of All the Blog Posts in the website.
    4. To retrieve the list of All the News Items in the website.

    Also how do I find the absolute url for each item (let's say a NewsItem)?

    Thanks,
    Duneel

  • Hi Duneel,

    1. To retrieve the list of ALL the pages in the website (Non backend pages).

    var pages = App.WorkWith().Pages().LocatedIn(Telerik.Sitefinity.Fluent.Pages.PageLocation.Frontend).Get().ToList();


    2. To retrieve the list of All the Blogs in the website.

    var blogs = App.WorkWith().Blogs().Get().ToList();

    3. To retrieve the list of All the Blog Posts in the website.

     var blogs = App.WorkWith().BlogPosts().Get().ToList();

    4. To retrieve the list of All the News Items in the website.

    var blogs = App.WorkWith().NewsItems().Get().ToList();


    Also how do I find the absolute url for each item (let's say a NewsItem)?


    You should know the page on which news widget is dropped. The url is based on this page and the UrlName of the content item.

    Greetings,
    Ivan Dimitrov
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  • Hi Ivan,

    Thanks for responding. Just one more thing... How do I find the absolute URL of each page nodes? What is the property i have to read?

    Thanks,
    Duneel
  • Hello Duneel,

    For pages, each PageNode has a property - Urls. In the urls collection of UrlData objects when RedirectToDefault == false this is the default page url.

    Greetings,
    Ivan Dimitrov
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  • Ivan-

    Did the API change?
    var blogs = App.WorkWith().BlogPosts().Get().ToList();

    Visual Studio doesn't recognize the "ToList" method. 
  • ".ToList()" is an extension method in the System.Linq namespace.  Be sure you have the "using System.Linq;" line at the top of your page.