Weird CQWP behaviour with custom user columns

So one of my colleagues approached me today with a problem he was having setting up a new content query web part for a client. it’s a fairly simple affair that just needs to pull together project statuses across a site collection. No cross site query issues, no custom field types to worry about.. Just a simple list.

Or so we thought, Try as we might we could not get two of the fields to return a value, BusinessOwner and ProjectManager. In the Content Type, these site columns are simple People or Group field types, set to display the name without presence.

Without any further ado I fired up my trusty development VM and started playing around to re-create the issue.

  1. Create a new content type based on the List Content Types/Item parent. published to Custom Content Types group.
  2. Added a new site column called GreenBanana to the new content type. This is set to be a People or Group column, with the additional settings of Not required, No multiselect,People Only, All users and show field as name (Subsequently tested with Name and Presence and no difference.)
  3. To simulate the nested nature of the query in the client environment, I create a new sub-site in my site collection, added a new list and configured this list to use the new content type.
  4. Create 2-3 new items in the list, ensuring that the GreenBanana field has a value of my test user configured.
  5. Back to the root site of the Site Collection, create a new content query web part on the page and set it up to retrieve the new content type frm all sites in the site collection. As expected, the 3 new items duly appear.
  6. Now we export the CQWP to point it at the custom XSL that I have prepared. In addition I’m adding “GreenBanana,Text; to the CommonViewFields property to make it available in the returned XML. (Note: I’m using Text not User as the field type.)
  7. Delete the original CQWP and upload my newly updated one.

The newly uploaded one shows me the 3 items that I expect, so modify shared webpart and point the item style at my showXML style. (Just a simple XSL that outputs all of the available fields and their values.)
The heading GreenBanana shows, but not value.
So, we’re at the stage that my colleague got to, No value in the custom site column based on the people type. Just an heading and an empty value.


So, thinking that I might be pulling an item frm somewhere else (despite this being a new content type) I decided to filter only on items that included me in the GreenBanana column.


Whoa.. Ok, why did that happen? It is definitely the same item that I had previously, but now I have a value. Setting the filter to be Show me everything where the GreenBanana column is not equal to Administrator shows me all three items AND their values.

Weird.. and at the moment I don’t have an explanation.


1 comment

  1. We raised a call with Microsoft PSS in the end and we’ve been told today by PSS after consulting with the SharePoint dev team that this is a known issue and that Custom Fields using the People or Groups field type do NOT work with the CQWP, only out of the box fields.

    The workaround above does work, however further tests show it’s not reliable and is very situational.


Leave a Reply

Your email address will not be published.


This site uses Akismet to reduce spam. Learn how your comment data is processed.