Business Productivity and Information Architecture

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

Sara said:

Hi Michael,

I am hoping you can help me. I have a CQWP that adds the body of an announcement to it's display. Somehow users that have read-only access, see the title of the message but not the body.

Would you know why?

Thanks,

Sara

# March 16, 2010 12:19 PM

Rashina said:

We are using the content query web part to display the headline news on the home page. However, some of the article falls off (disappears) of the page. What can we do to resolve this issue?

# December 8, 2010 10:06 AM

Sudhir Keshawrani said:

Thanks Michael,

It worked like charm :)

# January 5, 2011 3:24 AM

Praveen said:

Hi Michel,

I am displaying list details grouped by cloumns.. i want to dispaly more link at right bottom corner of CQWP .. how to acheive that .. Hope you will help me out in this.

# February 10, 2011 8:21 AM

Felix said:

hi everyone,

about the usecache property, can we set the expiration times of  the cache? is the expiration times of th cache a property?

# March 1, 2011 8:05 PM

Shabih said:

Hi,

I am using content query web part on document library with versioning and content approval disabled. I have a content type that is inheriting from folder content type and i am querying CQWB based on that content type, but only 1 result is shown for all users except system account.

I have tried UseCached set to false but still it dosen't effect any thing. The same webpart is running perfectly on another evnoirnment.

Please Help...

# March 22, 2011 4:01 AM
Leave a Comment

(required) 

(required) 

(optional)
 

(required) 

If you can't read this number refresh your screen
Enter the numbers above: