Content Query Web Part March 2013 Peter Serzo SharePoint Fest
www.highmonkey.com
Twitter: pserzo Peter Serzo, MCP, MCSD .Net, MCTS High Monkey Consulting Blog: monkeyblog.highmonkey.com www.highmonkey.com PSerzo@highmonkey.com Twitter: pserzo Author Love to read and Love a Good Story
Outline & Agenda Simple Query/List Outof the Two Lists box Overrides Outof the box Multiple Files One Source Design XSLT Debugging
CQWP – Tour of out of the box features
CQWP – Tour of out of the box features RSS Feeds
CQWP – Tour of out of the box features Audience Targeting
CQWP uses 3 xsl files: ContentQueryMain.xsl ItemStyle.xsl Header.xsl
CQWP - Simple
CQWP - Simple Business Case 1: Simplywant todisplaycontentsof Announcementson Home Page in an aesthetically pleasing manner. http://blogs.msdn.com/b/ecm/archive/2010/05/14/what-s-new-with-the-content-query-web-part.aspx
CQWP - Query Business Case 2: Need to pull from 2 different lists: the Archive listand Regular list
CQWP - Query Overrides – Need towrite CAML Utilize the ListsOverride Property • <property name="ListsOverride" type="string"><![CDATA[<Lists><List ID="3FAD4E57-6DF2- 49EF-862E-6A0A671F2772"/><List ID="9B2BAD6C-EF0F- 42B6-A5E7-90DB92EAA12C"/></Lists>]]></property>
CQWP – What other Overrides are important <property name="ViewFieldsOverride" type="string"><![CDATA[<FieldRef Name="Title" Nullable="True" Type="Text"/><FieldRef Name="PublishingRollupImage" Nullable="True" Type="PublishingPageImage"/><FieldRef Name="FileRef" Nullable="True" Type="Lookup"/><FieldRef Name="Headline" Nullable="True" Type="Text"/><FieldRef Name="PublishingStartDate" Nullable="True" Type="DateTime"/><FieldRef Name="ArticleHasComments" Nullable="True" Type="Boolean"/>]]></property> <property name="QueryOverride" type="string"><![CDATA[<Where><Eq><FieldRef Name='Regional_x0020_Focus'/><Value Type='Choice'>Asia Pacific and Africa</Value></Eq></Where><OrderBy><FieldRef Name='PublishingStartDate' Ascending='False' /></OrderBy>]]></property>
Use U2U CamlDesigner for Query Overrides
CQWP – Multiple Files Business Case 3 Customer has several subsitesand wants to load a fileon oneand have it show upon the others.
CQWP – Multiple Files Review Create 3 Subsites 1. 2. Create Customcolumns 3. Create ContentType (Movies) 4. Create Document Library Add Content type 5. Add CQWP 6. Set Parameters
CQWP - Design Business Case 4: Customer wants a custom design for the web part called Feature Movie. And they want to pick the feature movie.
CQWP - Design You need SharePoint Designer!
Debugging XSLT Justwriting this because I always seem to be looking for it. This shows you what properties/fieldsand thevalues of these fields in thexsl when you are trying to render in a content querywebpart oradataview webpart. <xsl:for-each select="@*"> Property Name: <xsl:value-of select="name()"/> Value: <xsl:value-of select="." /> <br/> </xsl:for-each>
CQWP – Limitations and SQL Server Gotchas… • Site Collection Silos • Large Amtof Metadata in a List • How manyon a page – Use Query Overrides