• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Content query web part – get it all in one place and style it!
 

Content query web part – get it all in one place and style it!

on

  • 10,616 views

Session first given at SharePoint Fest in Chicago. It cover the Content Query Web Part or CQWP of SharePoint 2010.

Session first given at SharePoint Fest in Chicago. It cover the Content Query Web Part or CQWP of SharePoint 2010.

Statistics

Views

Total Views
10,616
Views on SlideShare
10,597
Embed Views
19

Actions

Likes
1
Downloads
119
Comments
0

1 Embed 19

https://twitter.com 19

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Content query web part – get it all in one place and style it! Content query web part – get it all in one place and style it! Presentation Transcript

    • Content Query Web Part – Get it all in one place and style it! Benjamin NiaulinPresented at: SharePoint Fest Chicago SharePoint Geek
    • Description More than once people have customized or developed a solution or web part to accommodate certain needs. Many times, these needs could have been met with a simple Out-of- the-Box Web Part called the Content Query Web Part. In this session we will explore the possibilities of querying the right content as well as changing the style to display these results.@bniaulin Share-gate.com
    • Who is this guy talking? Benjamin Niaulin Speaker, Trainer, Consultant, SCRUM Master Blog bniaulin.wordpress.com Website share-gate.com Email benjamin.niaulin@share-gate.com TWITTER!: @bniaulin @bniaulin Share-gate.com
    • Agenda Introduction The Content Query Web Part DEMO The XSL Files – What is that? What do they do? DEMO Dynamic Filtering DEMO Advanced CQWP Stuff@bniaulin Share-gate.com
    • INTRODUCTION
    • Problems we face Showing data from multiple lists/libraries at the same time Change the date format in a list/library Dynamic filtering Changing the look of a list/library Showing specific data from lists/libraries to the relevant audience@bniaulin Share-gate.com
    • CONTENT QUERY Web Part - Overview
    • Content Query Web Part (CQWP) Requires Site Collection Feature: Publishing Infrastructure* Helps create dynamic views based on what the user is looking at Power User can Edit the Query and the Style Aggregate content from the Site Collection Reusable and customizable styles@bniaulin Share-gate.com
    • Web Part Properties - Query Query Source List Type Content Type Audience Targeting Additional Filters@bniaulin Share-gate.com
    • Web Part Properties - Presentation Presentation Grouping and Sorting Sorting Item Limit Styles Fields to display Feed <-- Don’t underestimate!@bniaulin Share-gate.com
    • Examples By Ben Tedder on NBSP http://labs.steveottenad.com/sharepoint- 2010-xslt-date-formatting/ By Yohan Belval from Sharegate@bniaulin Share-gate.com
    • DEMO
    • XSL FILES – HUH?
    • Understanding XSLT XSLT: Extensible Stylesheet Language Transformations Basically transforms XML Ref: http://en.wikipedia.org/wiki/XSLT@bniaulin Share-gate.com
    • Understanding XSLT Debug itemstyle: <xsl:template name="Debug"match="Row[@Style=Debug]" mode="itemstyle"> <xsl:for-each select="@*"> P:<xsl:value-of select="name()" /> </xsl:for-each> </xsl:template> Learn xslt: http://www.w3schools.com/xsl/default.asp@bniaulin Share-gate.com
    • Display RAW Data of Query<xsl:template name="DisplayRawData"match="Row[@Style=DisplayRawData]" mode="itemstyle"><xsl:for-each select="@*"><xsl:value-of select="name()"/><xsl:text> = </xsl:text><xsl:value-of select="."/><br/></xsl:for-each><br/><br/><br/></xsl:template>@bniaulin Share-gate.com
    • XSL Files used by SharePoint There are 3 files used by the CQWP ContentQueryMain.xsl ItemStyle.xsl Header.xsl Files are located in the Style Library at the Root of your Site Collection Style LibraryXSL Style Sheets@bniaulin Share-gate.com
    • ContentQueryMain.xsl Contains logic that generates the appropriate calls to the Header and Item templates for each item. Contains functions that help designers modify the Item and Header XSLT transforms. Receives all the content, parses it, and sends appropriate pieces to the ItemStyle and Header templates. Maintains the structure of the Content By Query Web Part. Stores data retrieved when querying content in the path /dsQueryResponse/Rows/Row. MSDN Definition In short….@bniaulin Share-gate.com
    • ContentQueryMain.xsl Think of it as the big container of the WebPart In charge of what isn’t repeated (header, footer, calling CSS or JS to be used in your itemstyle after) It controls the flow of the content it receives Let’s check it out@bniaulin Share-gate.com
    • Header.xsl Contains templates that define how to display a header and ensure the consistency of group headers. Templates specified in Header.xsl receive the next item row to process, usually the first row in a group unless there are multiple columns. If there are multiple columns, the templates receive the first row of the column. You can retrieve data about the next item row by using the @Property directive. You can use the $Group parameter that contains the groupby column name and the $GroupType that represents the column type of the groupby column. MSDN Definition In short….@bniaulin Share-gate.com
    • Header.xsl When you use the CQWP with a GroupBy option the header.xsl is called.@bniaulin Share-gate.com
    • Itemstyle.xsl Contains templates that define how to display an item. These templates receive and process one row of data at a time, ensuring that the style and data in the item rows is consistent. You can retrieve data about a row by using the @Property directive. Basically it’s what gets applied to each “item” or row. <div class="right"> <span class="title"><xsl:value-of select="@Title" /></span> <span class="location">Location: <xsl:value-of select="@Location" /></span> @bniaulin Share-gate.com
    • Examples@bniaulin Share-gate.com
    • DEMO
    • DYNAMIC FILTERING
    • Dynamic Filters PageFieldValue Specify a field on the Page Layout to act as the filter for the Query PageQueryString Takes the value in the URL and applies it as the filter for the Query@bniaulin Share-gate.com
    • Example on MSDN BLogRef: MSDN Blog@bniaulin Share-gate.com
    • Morehttp://www.chakkaradeep.com/image.axd?picture=image_319.png @bniaulin Share-gate.com
    • ADVANCED PROPERTIES
    • Access the AdvancedProperties You can easily access advanced properties of the CQWP Edit Web Part Export into .webpart file Open with an XML editor (notepad, etc.) Modify the file Import .webpart back into your site@bniaulin Share-gate.com
    • More Advanced Stuff CommonViewFields Ask for additional fields By default the CQWP does not return all fields automatically QueryOverride When used, all settings for Query in the UI are greyed out Makes it possible to specify the query portion of a cross-list query in CAML.@bniaulin Share-gate.com
    • Still More Advanced Properties… WebsOverride Determines whether the cross-list query should recurse subsites. ListsOverride Specify which lists/library you want to query<property name="ListsOverride" type="string"><![CDATA[<Lists><List ID="31A7C09D-52CC-4585-B998-A3F180A9BD07"/><List ID="7382D66D-2E4C-47CB-A95C-5EECD68F5E61"/></Lists> ]]></property>@bniaulin Share-gate.com
    • DEMO Filter by File Extension
    • Q&A
    • THANK YOU!KEEP IN TOUCH ON TWITTER @BNIAULIN Benjamin Niaulin@bniaulin Share-gate.com