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

Forums / General Discussions / Getting list of documents from a specific library

Getting list of documents from a specific library

2 posts, 0 answered
  1. John
    John avatar
    97 posts
    Registered:
    11 Jan 2011
    10 Feb 2011
    Link to this post

    Hi

    How can I get list of documents from only a specific document library? I understand its something on these lines;

    List<Telerik.Sitefinity.Libraries.Model.Document> list;
    list = 
    App.WorkWith().Documents().Where( ??? ).Get().ToList();


    I don’t know what comes instead of ??? though.

    If I try this;

    list = App.WorkWith().Documents().Where(d => d.Status == 
    Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live).Get().ToList();


    I get documents from all libraries not just one specific library.

    What is the solution?

    Thanks

    Regards

  2. Bryan
    Bryan avatar
    62 posts
    Registered:
    20 Jul 2010
    10 Feb 2011
    Link to this post
    Give this a try:

    IEnumerable<Document> documents = App.WorkWith().DocumentLibrary(this.LibraryId)
        .Documents()
        .Where(d => d.Status == ContentLifecycleStatus.Live)
        .OrderByDescending(d => d.UrlName)
        .Get()
        .ToList();

    Bryan
2 posts, 0 answered