I have a CQWP embedded in a custom page layout which points to the OOTB Contacts list. The requirement is that the CQWP should pull from the Contacts list that is local to the site. But when a CQWP is added to the page layout in sharepoint designer it always points to the Contacts list that is in the root site of the sitecollection. I resolved the above issue by opening the page layout in sharepoint designer, going into the code view and then setting the ListGuid property to null and webUrl property to ~site The above resolution worked but please read on to know about the issue that this thread is about.

When I took the modified page layout (in which ListGuid was set to null and WebUrl set to ~site) and made that part of a package which I deployed to another environment I found that the CQWP was not working properly. The CQWP was not referencing the itemstyle.xsl in the other environment as it should so it was not getting displayed properly. In order to fix it, I had to open the page layout in the new environment using sharepoint designer. Then I right- click the CQWP and click OK which would reset the ListGuid and WebUrl to their original values. Then I would in code view reset the ListGuid to null and WebUrl to ~site and save the page layout. After this every thing would work correctly. We have to give this package to external party and we cannot tell them to make these silly tweaks in sharepoint designer after the package gets deployed.

So has anybody come across this before and can someone give some suggestions? Thanks in advance.


You can fully configure the CQWP in the client machine and export it as a .webpart file. Then you can upload it back to the webparts gallery and rename it to ContactsWebpart. This way it will be available for the users when they want to add this webpart in another page and it will work fine as it is configured properly with their List GUID and webUrl etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.