Thursday, September 11, 2008

Content Query Web Part

Sadly there is no built in cross-site list view web part. This seems like a pretty big oversight to me, but there are 3rd party tools that do the trick. However if you want that functionality from out of the box components you have to use a content query web part.

Using the content query part is fairly straightforward but there are two things you must remember:

  1. The columns you are filtering on have to be site columns
  2. If you find some of your list fields aren't available to your itemstyle.xsl, it's likely you'll have to modify the web part's xml. In order to do this complete the following steps.
  • Click the verb menu of the web part and choose to export the part to your file system
  • Open the .webpart file on your file system and find the 'CommonViewFields' property and add your field and its type.
  • Delete the old webpart from your page and reimport the webpart (click Add a web part to this zone then use the advanced settings to import, the import option is in the dropdown by the little triangle in the advanced settings)
  • Now your field will be accessible by itemstyles.xsl code.

No comments: