Zoek
THE NEW, FRIENDLIER SP 2010 CONTENT BY QUERY WEBPART
The Content By Query webpart (CQWP) is one of the most powerful and most commonly used tools in SharePoint. On top of that it also highly customizable. A big downside is that customizing the CQWP is tedious work. Especially if you do not want to alter SharePoint native files.

When I was working with the CQWP in SharePoint 2010 I found that most of the know nuisances are still there. For instance the ItemXslLink (and others) are still not configurable in the webpart configuration panel. But it seems one big improvement has been made: You do not longer have to set the CommonViewFields property (well, not if you do it right).

 

 

The SharePoint CQWP actively looks in the XSL style sheets for XML attribute references (@) it can’t resolve. If it finds them it will presents the user the possibility in the CQWP toolpart to map these attributes to SharePoint fields. For instance by default SharePoint would map the @Description attribute to the Comments field.

Even nicer is that you can even map multiple fields to 1 attribute. If the first field is empty the value of the second field is used.  

The new friendlyer Content By Query WebPart of SharePoint 2010

 

 
<xsl:template name="NoImage" match="Row[@Style='NoImage']" mode="itemstyle">
<xsl:variable name="SafeLinkUrl">
<xsl:call-template name="OuterTemplate.GetSafeLink">
<xsl:with-param name="UrlColumnName" select="'LinkUrl'"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="DisplayTitle">
<xsl:call-template name="OuterTemplate.GetTitle">
<xsl:with-param name="Title" select="@Title"/>
<xsl:with-param name="UrlColumnName" select="'LinkUrl'"/>
</xsl:call-template>
</xsl:variable>
<div class="item link-item">
<xsl:call-template name="OuterTemplate.CallPresenceStatusIconTemplate"/>
<a href="{$SafeLinkUrl}" title="{@LinkToolTip}">
<xsl:if test="$ItemsHaveStreams = 'True'">
<xsl:attribute name="onclick">
<xsl:value-of select="@OnClickForWebRendering"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="$ItemsHaveStreams != 'True' and @OpenInNewWindow = 'True'">
<xsl:attribute name="onclick">
<xsl:value-of disable-output-escaping="yes" select="$OnClickTargetAttribute"/>
</xsl:attribute>
</xsl:if>
<xsl:value-of select="$DisplayTitle"/>
</a>
<div class="description">
<xsl:value-of select="@Description" />
</div>
</div>

 Example snippet of itemstyle.xsl the @Description and @Title attributes are highlighted.

Er zijn nog geen commentaren voor dit bericht.
Voor items in deze lijst moet de inhoud worden goedgekeurd. De ingediende gegevens worden pas weergegeven in openbare weergaven als deze zijn goedgekeurd door iemand met de vereiste machtigingen.
Titel * 
Opmerking * 
The new friendlier SharePoint 2010 Content By Query Web Part 
Microsoft Partner - Gold competence Portals and Collaboration
Microsoft Partner - Gold competence Systems Management
© COPYRIGHT ADVANTIVE 2010 | LEGAL NOTICE