CQWP that lists all documents checked out to mePosted: 2012-05-27
I thought I would show you how you could make the CQWP list all documents in your Site Collection that are checked out to me.
The thing is, if you set the CQWP to search the whole site collection or a site for that matter, and then choose “List Type” “Document Library” you will not be able to choose the filter “Checked Out To”.
So how should we do to then?
First of all if you navigate to “Site actions” and “Manage Content and Structure” and then choose “Content and Structure Reports” you will find the reports and the CAML that is used for them. What you should do is to copy the CAML query from the report “Checked Out To Me”.
<Where><Eq><FieldRef Name="CheckoutUser" LookupId="TRUE"/><Value Type="Integer"><UserID/></Value></Eq></Where>
Now, add a CQWP to your page and set it to search a site of your choice, set the “List Type” to “Document Library” and give it a name, chrome type and so on, but don’t set any filters.
Now export the CQWP and open it with Notepad.
Lookup the property “QueryOverride” and replace that row with this one:
<property name="QueryOverride" type="string"><![CDATA[<Where><Eq><FieldRef Name="CheckoutUser" LookupId="TRUE"/><Value Type="Integer"><UserID/></Value></Eq></Where>]]> </property>
As you can see I have already added the CAML from the report for you.
Now save this file somewhere and upload it to the web part gallery.
Now you have a web part you could add that will list all documents checked out to me.