1 / 24

Content Query Web Part

Content Query Web Part. Brendon Pilott Systems Administrator Gracelands Group of Services Twitter: @ brendonpilott E-mail: brendon@gracelands.org.nz. Blog List. Content Query. Document Library. Content Query. Custom List. Content Query. What is it?.

marv
Download Presentation

Content Query Web Part

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Content Query Web Part Brendon Pilott Systems Administrator Gracelands Group of Services Twitter: @brendonpilott E-mail: brendon@gracelands.org.nz

  2. Blog List

  3. Content Query

  4. Document Library

  5. Content Query

  6. Custom List

  7. Content Query

  8. What is it? “Content Query is a Web Part that displays a dynamic set of items based on a query that you build by using a Web browser. You use the query to specify which items are displayed, and you can set presentation options to determine how those items are displayed on the finished page” - Microsoft

  9. What does it do? • Display content from multiple lists and sites • Filter content so it is relevant • Dynamic view of content on a page • Most current content, refreshed on every page load • Can be styled with XSL and CSS

  10. How does it work? • It builds a CAML (Collaborative Application Markup Language) query and uses the Microsoft.SharePoint.SPSiteDataQuery class to query the server • Presentation options are applied • Security trimmed • Content Query Web Part (CQWP) automatically displays new content

  11. Extensible Stylesheet Language (XSL) • CQWP uses XSL files located in: • \Style Library\XSL Style Sheets\ • They parse the query results for display on the page • Do not edit the original XSL files • Create copies in a sub-folder, edit as necessary and modify the CQWP to use the new XSL files

  12. Important XSL files • ContentQueryMain.xsl • Generates the appropriate calls to the Header and Item templates • ItemStyle.xsl • Contains templates that define how to display an item • Header.xsl • Contains templates that defines how to display a header

  13. How are templates structured? • Each template starts with <xsl:template … … > • This defines the template name, the match string and the mode, and the template ends with </xsl:template> • Each template includes two sections: • <xsl:variable> processes the data and ensures correct formatting, especially used for images and links • <div> sections renders the HTML, includes the data, and applies styles from CSS classes

  14. Issues and workarounds • Limited to 1000 lists – there is a workaround but be wary of the performance hit • Does not display items that are checked out or are not published or approved - workaround is to change the web part UseCache property to False • Does not work with anonymous access - workaround is to add two fields to the web part properties • If you want to filter on custom fields that are not in site columns then you may have to add the field names to the AdditionalFilterFields property

  15. Issues and workarounds • It pulls from the database every column in your list even if you only need to display a few columns • This causes the query to take longer and moves a lot more data from the database server to the web front end • Solution: • When you use ViewFieldsOverride you can specify the columns you want to display and SharePoint won’t pull back all of the extra columns

  16. Who can use it? • MOSS 2007 • SharePoint 2010 Standard and Enterprise • It is not available in WSS or Foundation because it needs the SharePoint Publishing Features

  17. Key Feature - Query

  18. Key Feature - Filtering

  19. Key Feature - Filtering • Dynamic Filtering • If you want the filter to use data that is specific to a page • PageFieldValue • Dynamically replace the filter value with the current page’s field value • PageQueryString • Looks at the URL query string for a value to use in the Query

  20. Key Feature - Presentation

  21. Key Feature - Presentation

  22. Web Part Properties

  23. Demo • Enable publishing feature on the site collection and on the site • Add a CQWP to a page • Configure the CQWP – Query, Filter, Presentation • Create a new XSL Template and make it look good

  24. Content Slide • 4th Annual Community SharePoint Conference • Business and Technical Tracks, all levels • Superb Internationally Renowned SharePoint Experts • EARLY BIRD DISCOUNT- $650.00 (full price $750.00) • Register NOW: www.sharepointconference.co.nz

More Related