16 September 2011

SharePoint 2010 CQWP on page layouts with Metadata field filter

Somebody posted this issue on technet site http://social.technet.microsoft.com/Forums/en-CA/sharepoint2010customization/thread/4b0ac094-cbbb-4f24-badb-495c2c53a852?prof=required: I'm using the CQWP on a page layout in SP 2010 in order to provde users with links to associated content. similar to this blog post. http://blogs.msdn.com/b/ecm/archive/2010/05/14/what-s-new-with-the-content-query-web-part.aspx When I try to filter a specifc content type with the Managed Metadata field and use the [PageFieldValue: Colmun Name] within the CQWP on a page layout in SP Desinger 2010 nothing happens when I click OK on the web part properties. The web part will not accept the changes, but there is no error message. When I add the same CQWP via the browser the web part works fine, but it seam that I can't create a new page layout with this configuration. Can anybody tell me if this is a bug, if there is a work around or do I need to configure something to get this CQWP working. Solution: ok, this is a bug in SPD. This does not work in designer mode, but workaround is to do it in code. Lets suppose on the page there is the metadata field called "Site Owner", there is a list in "Site Name" sub-site called "Links" which has the same metadata field "Site Owner". If you include all these fields your page layout should rock!! Switch to the code view and make sure following attributes are added with correct value: ListGuid="bd3cfade-31d9-48d9-9ca0-a0e49923dcs272f0e" FilterField1="Site_x0020_Owner" FilterValue1="[PageFieldValue:7bdc0fac-c3f6-481f-9114-0e086e923224d:Site_x0020_Owner:TaxonomyFieldTypeMulti]" FilterDisplayValue1="[PageFieldValue: Site Owner]" FilterField1="Site_x0020_Owner" WebUrl="~sitecollection/Site Name/" ListName ="Links"

0 comments: