Sharepoint - Listing all checked out files

Depending on what you are trying to do there are a few approaches to this:

-- Use the Manage Content and Structure Reports as per http://blogs.syrinx.com/blogs/sharepoint/archive/2008/04/14/content-and-structure-reports-just-a-caml-ride-away.aspx but this is fairly limited as it doesn't let you specify who checked out the document and on which site.

-- Use the object model - this gives you more flexibility but requires the code to be running on the SharePoint server. To do this you could use a query such as the following:

using (SPWeb web = new SPSite("http://intranet/").OpenWeb())
{
    SPSiteDataQuery q = new SPSiteDataQuery();
    q.Lists = "<Lists BaseType='1'/>";
    q.Query = "<Where><Geq><FieldRef Name='CheckoutUser' LookupId='TRUE'/><Value Type='int'>0</Value></Geq></Where>";
    q.Webs = "<Webs Scope='SiteCollection' />";
    q.ViewFields = "<FieldRef Name='Title' /><FieldRef Name='ID' />";
    q.RowLimit = 10;
}

-- Use the web services to allow you to run the code remotely. This would likely require more effort but should be achievable using the Query web service as long as you expose the CheckoutUser field as a managed property in the search settings for the SSP.

Tags:

Web Services