Displaycustom fields in a Content Query Web PartD



Add a Content Query Web Part to a page.
* In the Query section, set the Source to show items from the Knowledge Base Articles document library (list). Set the list type and content type accordingly.
* In the Presentation section, set the Item Style to Title and description.


Edit the properties in the Web Part file to display custom fields. To access the .webpart file for the Web Part, on the Web Part’s edit menu, click Export.
* Office SharePoint Server 2007 generates a .webpart file with the complete set of properties that are available for this Web Part. The .webpart file is an XML file that you can edit using a text editor.

In the .webpart file, locate the CommonViewFields property. Use this property to specify the additional fields you want to display in the Web Part. Add the internal names of the columns and the type.
Copy Code



You cannot use your columns’ display names in this property. You can find the internal column names by checking the properties of the column in the list or document library. Right-click the column, and then click Properties. The internal name of a column appears in the Address (URL) property after ‘Field=’. In the Knowledge Base Articles scenario, the columns are Knowledge Base Article and Product and their internal names are KB_x0020_Title and Product, respectively.

Map these internal column names to the columns’ Title and Description present in the XSLT transformations. To do this, edit the DataColumnRenames property.
Copy Code



The default XSLT transformations can render the following four fields: Title, Description, LinkUrl, and ImageUrl. In your DataColumnRenames property, verify that the names you specify match the names in the XSLT transformations; that is, Title, Description, LinkUrl, and ImageUrl.

Save the .webpart file locally.

In the Web page, delete the Content Query Web Part you added in step 1.

Import the .webpart file and add the Web Part to your page. To import the .webpart file, click Page, click Add Web Parts, and then click Import. Browse to the .webpart file, and then click Upload.

Drag the Web Part to the appropriate zone in the page. The Web Part should display the Knowledge Base Title and the product name.


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 )

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s