SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 6 down vote accepted

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);
share|improve this answer
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 '12 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 '12 at 8:49
Thanks. Would this code go into an application page? – Alex C Apr 1 '12 at 9:00
Why not? This code should work anyway when you have access to the SharePoint object model :) – Alexander Apr 1 '12 at 9:05
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 – Per Jakobsen Apr 1 '12 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

share|improve this answer
Didn't know you could do that! Thanks, Bas Lijten! Just tried it and worked beautifully :) – Alex C Apr 2 '12 at 5:16
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 '12 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)


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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