SharePoint world of ECM and Information Management

Why Content Query Web Part (CQWP) doesn’t return all results.

I’ve seen several cases, when people use CQWP and surprises when it doesn’t return all items in standard mode and returns all necessary items in “edit” mode. I find this topic is not being documented enough anywhere.

So, CQWP ignores following items from your queried data:

  1. Items are checked-out
  2. Items are not published and not-approved

Those scenarios are “behaviour by design”, and I found such behaviour logical. User’s are working on their items, and work in progress – you shouldn’t show such items

Workaround: set “UseCache” property to “false”.

Cite from SharePoint team:

You are only seeing your items in edit mode because the caching infrastructure of the CQWP does not cache checked-out items of individual users and we disable cache in edit mode.  You can disable caching on your Web Part by setting the "UseCache" property to false

So, my recommendation is to revise your approach to return published and checked-in stuff only.

 

Mirror: Why Content Query Web Part (CQWP) doesn’t return all results.

Comments

kate said:

bizzarrely, if you add a filter on checkoutUser Not eq to [Me]  then the checked out items will appear in display mode regardless of cache settings

# September 3, 2009 9:20 AM

Michael said:

hmmm, interesting.

Can you say the exact version of SharePoint 2007 you are using.

I think it might be fixed in one of the SP or updates, but need to know you version number where you have such behavior

# September 3, 2009 10:22 AM

Franck said:

I also got some weird behavior with CQWP on discussion boards with content approval:

1. Without any filtering, I only got all the approved items.

2. As Kate mentionned, using the filter "CreatedBy=[Me]" lists all my items even the pending or rejected ones!

3. Using the filter "CreatedBy=[Me] OR CreatedBy!=[Me]" outputs all my items (including the pending or rejected ones) and, oddly some but not all the approved ones!

MOSS version is 2007 SP2 April'09 CU (Enterprise ed)

# September 9, 2009 8:57 AM

Boris Gomiunik said:

Thank you! UseCache property to False did the trick!

# September 28, 2009 2:29 AM

David Hamilton said:

Worked perfectly and very simple.  Thanks.

David

# October 20, 2009 2:15 PM

Alessandro said:

Hi, I have a similar problem: I'm grouping the documents by a field (month). In anonymous navigation everything works fine (only approved items are shown), but if a contributor is logged and there are unapproved items, they aren't grouped together with the ones having the same month, but another grouping is created!

E.g.:

Doc Lib contains:

Doc 1 Month March Approved

Doc 2 Month March Approved

Doc 3 Month March Published

Doc 4 Month April Approved

Doc 5 Month April Approved

Doc 6 Month April Published

CQWP will show (with grouping field Month):

March

- Doc 1

- Doc 2

April

- Doc 4

- Doc 5

March

- Doc 3

April

- Doc 6

Any idea on this weird behaviour?

Thanks!  

# October 23, 2009 4:05 AM

Michael said:

What's the version of Service Pack installed on SharePoint?! Is it SP2?!

# October 23, 2009 4:09 AM

Alessandro said:

SP1...

# October 23, 2009 4:14 AM

Michael said:

SP1 is definitely a reason of your issue, I reckon. SP1 is dated back to fall of 2007, but now is year 2009 -  you are on the system without 2 years old updates.

My strongly recommendation is to update to SP2 and then test again. I bet the issue will be fixed.

# October 23, 2009 4:19 AM

Alessandro said:

WOAH! UseCache worked for me too!

# October 23, 2009 4:21 AM

Marije Oosterhek said:

Hello. Were exactely do I find the UseCache?

# February 4, 2010 10:34 AM

Michael said:

It's a WebPart declarative property

<property name="UseCache" type="bool">True</property>

# February 4, 2010 2:51 PM
Leave a Comment

(required) 

(required) 

(optional)

(required)