Content Query Web Part not rendering calendar list description field
-
16-10-2019 - |
Question
We have a SP2010 site that we are making extensive use of the CQWP (Content Query Web Part) on. When I point the CQWP at a specific list it displays description value fine. The problem is when I point it at a hierarchy of SPWebs and configure it to rollup all items of type Calendar. When I do this all data comes through fine except for Description, which is very odd. I tried using internal field name too it doesn't seem to make any difference.
So my question is how do I get CQWP to render description field from multiple calendar lists?
<xsl:template name="MyEventStyle" match="Row[@Style='MyEventStyle']" mode="itemstyle">
<div class="webpart-item">
<h2>
<span class="tooltip-event-selector"><xsl:value-of select="@Title"/></span>
</h2>
<p class="date"><xsl:value-of select="ddwrt:FormatDate(@EventDate, 1033, 1)" /></p>
<div class="webpart-item-content">
<xsl:value-of disable-output-escaping="yes" select="@Description" />
<a>
<xsl:attribute name="href"><xsl:value-of select="concat('/HomePageFeed/events/calendar.aspx?IsDlg=1&CalendarDateIs=', ddwrt:FormatDate(@EventDate, 1033, 1))" /></xsl:attribute>
<xsl:attribute name="class">dialog-pop</xsl:attribute>
</a>
</div>
<div class="hidden">
<div class="tooltip-event-content">
<div><strong>Event Information</strong></div>
<div><xsl:value-of select="ddwrt:FormatDate(@EventDate, 1033, 1)" /></div>
<div><xsl:value-of select="ddwrt:FormatDate(@EventDate, 1033, 4)" /> - <xsl:value-of select="ddwrt:FormatDate(@EndDate, 1033, 4)" /></div>
<div><xsl:value-of select="@Description" /></div>
</div>
</div>
</div>
</xsl:template>
Solution
I was able to get this working by changing the DataMappings, and DataMappingViewFields. The values in these fields are very sensitive and a space or semi-colon in the wrong place will break it. I've posted what worked below, hopefully this will save someone else two days of misery!
<property name="DataMappings" type="string">Title:{fa564e0f-0c70-4ab9-b863-0177e6ddd247},Title,Text;|LinkUrl:|Description:{9da97a8a-1da5-4a77-98d3-4bc10456e700},Comments,Note;|ImageUrl:{b9e6f3ae-5632-4b13-b636-9d1a2bd67120},EncodedAbsThumbnailUrl,Computed;{543bc2cf-1f30-488e-8f25-6fe3b689d9ac},PublishingRollupImage,Image;|EndDate:{2684f9f2-54be-429f-ba06-76754fc056bf},EndDate,DateTime;|EventDate:{64cd368d-2f95-4bfc-a1f9-8d4324ecb007},StartDate,DateTime;|</property>
<property name="DataMappingViewFields" type="string">{b9e6f3ae-5632-4b13-b636-9d1a2bd67120},Computed;{543bc2cf-1f30-488e-8f25-6fe3b689d9ac},Image;{fa564e0f-0c70-4ab9-b863-0177e6ddd247},Text;{9da97a8a-1da5-4a77-98d3-4bc10456e700},Note;{64cd368d-2f95-4bfc-a1f9-8d4324ecb007},DateTime;{2684f9f2-54be-429f-ba06-76754fc056bf},DateTime;</property>