CQWP that lists all documents checked out to me
Posted: 2012-05-27 Filed under: CAML, Web parts | Tags: CAML, Content Query Web Part, CQWP, Filter, QueryOverride 7 CommentsHi everyone!
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.
That’s it!
Now you have a web part you could add that will list all documents checked out to me.
CU!
/SPNiax
Hi
very useful.
I have a problem, The query returns too many results and I get the error:
Your query returned a greater number of results than the web application’s query throttling limit. Please adjust the configuration of this Web Part or increase the throttling limit.
If I select a single site it works, if I select a Site Collection I have the error. I wanted to show the user all files in Site collection.
Any way around this besides increasing the LVT ?
Thanks
Hi Raj,
I am sorry but I don’t know of any other way to do that.
If you would come up with something, please let me and everyone else know as well 🙂
/SPNiax
Hi.
This is exactly what I’m looking for but I’m getting the same error as Raj. I’m sure I don’t have more than 5-10 documents checked out but still the webpart is giving me the “Your query returned a greater number of results that the web application’s query throttling limit …”
Can you think of anything that can cause that?
Hi,
It might actually be that I was misstaken when I thought that the Query result would be the documents being checked out. Infact it seems like it’s the total amount of documents being checked that it refers to. So I guess one has to modify the throttling limit…?
/SPNiax
Thanks for the answer
Wouldn’t “relevant documents web part” be an OOTB option for this case? This could maybe also be the solution for Raj.
Thanks for participating, Marco!
Yeah, if you want to have documents whithin the same site, that OOTB WP would work just fine.
But if you need to have a more “global” view in one place, I think this is one way to do it.
Rajs headache is that they got way to many documents checked out, as I see it. I can’t understand why one would want to have that amount of documents checked out.
Maybe that person should revise how the work is done, I don’t know?
And I don’t judge anyone for the way they work, just a thought 🙂
/SPNiax