Solving the problem of delaying content in CQWP

One of the most common problems which you may see in dealing with CQWP is the delaying of fetching the content from its source, like a list library for example.

I do make a search and found many solutions, one of the most efficient and simple is trying this to instantly presenting the content in CQWP without any delay is disabling caching.

but why such scenario happened?

it’s due to some cases like :

  • Items are checked-out
  • Items are not published and not-approved

Such behavior is  logical ; User’s are working on their items, and work in progress – you shouldn’t show such items instantly !

so what’s the solution ?!

simply you should put the UseCache property to : False.

How cani do this ?

you have many ways, you can open the page containing the CQWP with SharePoint designer in the design mode select the CQWP and switch to code view and add the following property:

UseCache=”False” to the <WpNs(n):ContentByQueryWebPart .. element (with (n) an integer).

but this scenario may not be succeeded due to many reasons.

The better solution is to do the following :

make the page in edit mode, then i exported the CQWP which make delay.

after that i edited it using notepad and change the property UseCache to False, then save the CQWP with another name so as to keep the source safe.

finally importing this CQWP by pressing the add a webpart link inside the page which is in edit mode.

all my contents now appear immediately without any delay :).

here you are references for such problem:

http://msdn.microsoft.com/en-us/library/aa981241.aspx

http://arabic2000.com/blog/index.php/archives/356

http://www.sharepointbloggers.com/2011/01/sharepoint-2010-content-query-web-part.html

Advertisements

About Hossam Kamal

Hossam Kamal Senior SharePoint Developer with high development skills in C#, ASP.NET, SharePoint Server Technologies, jQuery, CSS, XML, O.O.D, SSRS and MS.SQL Server.
This entry was posted in SharePoint Development, SharePoint General. Bookmark the permalink.

2 Responses to Solving the problem of delaying content in CQWP

  1. Rob Dixon says:

    After some research, I found that this is because Publishing was enabled at the Site Collection level. Even though publishing was not enabled on my site, it was still happening to me. This did the trick though. Works like a charm! Thank you for sharing — this made my day much easier and the client happy.

  2. Arjan R says:

    There is a beter way to do this, without exporting the webpart, change it en put it back. The way is called: PowerShell:
    #checkout the page manually ( next step is checking the page out through powershell.)
    $url = “http://contoso.com/contoso”
    $pageUrl = “pages/page.aspx”
    $wpTitle = “Opleidingsintranetten”

    $web = Get-SPWeb $url
    $wpManager=$web.GetLimitedWebPartManager($pageUrl,[System.Web.UI.WebControls.WebParts.PersonalizationScope]::Shared)
    foreach($wp in $wpManager.WebParts){
    if($wp .Title -eq $wpTitle){
    $wp = $webPart
    }
    $wp.UseCache = $false
    $wpManager.SaveChanges($wp)

    Goodluck.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s