Content Query Web Part – Field Types

http://blogs.inetium.com/blogs/bcaauwe/archive/2008/12/01/content-query-web-part-field-types.aspx

Over the last few months I have had to configure various Content Query Web Parts (CQWP) to provide portal rollups that can be pre-packaged and re-configured in the SharePoint UI instead of having to use SharePoint Designer when using Data View Web Parts.

I could go into the basics of setting up a CQWP, but since others have done it for us I’ll just provide some link love here. Even though this post if fairly old it provides a TON of value for those getting started with the CQWP, but the main thing I find missing is how to identify the items needed in the CommonViewFields property. You can find the internal field name pretty easy by going to your list settings, and then look at the URL when you hover over the column you want to identify. The Field Query String parameter gives you the internal name you need.

Now that you have the internal name for the columns you need, now you need the column type.  I haven’t been able to find a decent resource for all of the column types, so I figured this is where I needed to list them all out:

Display Column Type

Internal Column Type

Single line of text

Text

Multiple lines of text

Note

Choice

Choice

Number

Number

Currency

Currency

Date and Time

DateTime

Lookup

Lookup

Yes/No

Boolean

Person or Group

User

Hyperlink or Picture

URL

Calculated

Calculated

 

Of course these are all the default column types you can create, however there are some others, like the Publishing columns such as:

Display Column Type

Internal Column Type

Publishing Image

Image

Publishing HTML

HTML

Another nice way to see what these values are would be to use PowerShell.  I will often drop into PowerShell and look at the fields in a specific list to view the internal name, along with other variables, the following lines will output a table of all fields associated with a list and the Display Name, Internal Name, Display Column Type, and the Internal Column Type:

 

[System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.SharePoint”)

 

$site = new-object Microsoft.SharePoint.SPSite(“http://moss150”)

$web = $site.OpenWeb()

$list = $web.Lists[“CQWP”]

$list.Fields | Format-Table Title, InternalName, TypeDisplayName, TypeAsString

Having these items should now set you up to have all the information you need to customize your Content Query Web Part. Just create a customized template in the ItemStyle.xsl (or create your own custom XSL file and link to it using the ItemXslLink property in your .webpart file) to render the information you need and you should be ready to start utilizing the infamous Content Query Web Part.

Advertisements

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