When content editors are adding content within Umbraco, they might not always want to instantly publish every page to the website straightaway. You can do this by setting a pages publish date to a future date, as described in How To Unpublish a Page In The Umbraco Backend. An unpublished page post is a page post that won’t be visible on your page and from my experience, it's really easy to forget where you've created unpublished pages.
When you're creating backend Umbraco packages, sections and custom backend pages, you may need to display a list of unpublished pages to help make the content editors' lives a little easier. On the majority of sites I've worked on that's needed this type of functionailty, it's been the news, or blog post section where I've implemented an unpublished page list. If you only need to find all the unpublished pages of a certain document type, you can use the GetContentOfContentType() and then filter those pages by it's published state, like so:
var blogType = DocumentType.GetByAlias("alias"); var tutorials = ApplicationContext.Current.Services.ContentService.GetContentOfContentType(blogType.Id);
Now we have a list of IContent pages, we can use the IContent Published property to filter out any unpublished pages, like so:
var unpublishedPages = tutorials .Where(y => y.Published == false) .OrderByDescending(b => b.PublishDate);
When you work with the content service you can either work with the Content Service API, which is slower and talks to the the database directly, or the Content Service that commutes with the Examine cache. As performance won't be as big of an issue in a backend page/extensions as it would be on the frontend side of the website, the content service is an acceptable API to use. When you work with the content type service API, you will get published and unpublished pages back, which you can filter out using the 'Published' property.