For a specific SharePoint 2010 web site, is there a way to get a list of all publishing pages (Pages library) items that are checked out regardless of how many subfolders deep they are located? Thanks.

3 Answers 3


try to use this query:

SPQuery q = new SPQuery();
q.ViewAttributes = "Scope=\"Recursive\""
q.Query = "<Where><Geq><FieldRef Name='CheckoutUser' LookupId='TRUE'/><Value Type='int'>0</Value></Geq></Where>";
var pages = pagesList.GetItems(q);
  • Thanks, Alexander. A silly follow-up: Is this a PowerShell script or server-side ASP.NET code? And can this be done in a way such that we can check in the checked out pages? Thanks.
    – Alex C
    Apr 1, 2012 at 8:34
  • this is a server side code.. but I do not see any reason why do you not to use this solution is PowerShell. I think that checked in files has null value in this filed, but I'm not sure.
    – Alexander
    Apr 1, 2012 at 8:49
  • Thanks. Would this code go into an application page?
    – Alex C
    Apr 1, 2012 at 9:00
  • 1
    Why not? This code should work anyway when you have access to the SharePoint object model :)
    – Alexander
    Apr 1, 2012 at 9:05
  • 3
    What you get back using this method is the SPListItem for each page. For each of these you can get the listitem.File object and call CheckIn and Publish on that.<br />The code can go into a application page, console app, web part, ... what ever you want or be rewritten to PowerShell syntax Apr 1, 2012 at 9:24

Another, non code way to get a list of all checked out items, is the following. This is a neat small tool for your content editors, too.

  1. go to http://website/Reports%20List/AllItems.aspx
  2. Add new item. At the same query as above (0)
  3. go to the sitemanager http:///_layouts/sitemanager.aspx
  4. Select your library with publishing pages in it.
  5. Select in "View" the name of the query that you added:

reports view with checked out items

  • Didn't know you could do that! Thanks, Bas Lijten! Just tried it and worked beautifully :)
    – Alex C
    Apr 2, 2012 at 5:16
  • 1
    a lot of people don't know about it ;). It's one of those gems that I love! A custom view on a lib would have worked too, btw.
    – Bas Lijten
    Apr 2, 2012 at 8:19

In a publishing site you can use Manage Content and Structure and under view change it to "All Draft documents"

(Site actions > Manage Content Structure)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.