Getting list of documents from a specific library

Posted by Community Admin on 03-Aug-2018 04:20

Getting list of documents from a specific library

All Replies

Posted by Community Admin on 10-Feb-2011 00:00

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

Posted by Community Admin on 10-Feb-2011 00:00

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

This thread is closed