1 / 35

A Roll-Up of Fun Lessons Learned Using the Content Query Web Part CQWP

Session Agenda. Why the CQWP is so coolHow we use itConfiguring and using with custom dataTips

kioshi
Download Presentation

A Roll-Up of Fun Lessons Learned Using the Content Query Web Part CQWP

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


    2. A Roll-Up of Fun & Lessons Learned Using the Content Query Web Part (CQWP) Sean Squires Program Manager Microsoft Corporation

    3. Session Agenda Why the CQWP is so cool How we use it Configuring and using with custom data Tips & tricks Custom modifications we’ve done Environment needed to support this modelEnvironment needed to support this model

    4. Goals & Objectives Highlight why the Content Query Web Part (CQWP) is such a powerful approach for managing content in a SharePoint portal. Discuss (and demo!) some of the common configurations required to display custom field data. Illustrate some creative applications & extensions we’ve done.

    5. Why is the CQWP so cool? Powerful web part for presenting and delivering data to one or more places from one or more places. With careful site design, this roll-up web part facilitates a lot of content scenarios. Use with tagging and targeting scenarios to display relevant data easily on pages throughout the site Allows you to centralize the content in the presentation layer regardless of where it resides Slide Notes: The CQWP is one of the new web content management web parts introduced in MOSS 2007. It is part of the publishing features set so this will need to be activated for the web part to be available in the gallery. NOTE: it is not available in WSS. The web part displays a dynamic view of content on a page. It can be configured to retrieve items from a single list, a single site and subsites or the entire site collection (scope = single site collection). It builds a CAML (Collaborative Application Markup Language) query and uses the new Microsoft.SharePoint.SPSiteDataQuery class to query the server. Filtering, sorting, ordering and grouping can all be configured in the Web Part properties. Query results are displayed via a set of presentation options to determine the style format, number, grouping, and ordering. Items displayed reflect the current set of security trimmed items retrieved by the query Query is run whenever the page that contains the Part is viewed. If new content is added and it meets the query criteria, the Content Query Web Part automatically displays it. The key elements of the web part are: query, presentation, + any additional filtering. Functionally it works and you provides values OOB, but if you want to query custom content types and/or fields you’ll need to manipulate the *.webpart files It is a powerful new feature that we have found use for in a wide variety of content management/publishing/delivery scenarios Slide Notes: The CQWP is one of the new web content management web parts introduced in MOSS 2007. It is part of the publishing features set so this will need to be activated for the web part to be available in the gallery. NOTE: it is not available in WSS. The web part displays a dynamic view of content on a page. It can be configured to retrieve items from a single list, a single site and subsites or the entire site collection (scope = single site collection). It builds a CAML (Collaborative Application Markup Language) query and uses the new Microsoft.SharePoint.SPSiteDataQuery class to query the server. Filtering, sorting, ordering and grouping can all be configured in the Web Part properties. Query results are displayed via a set of presentation options to determine the style format, number, grouping, and ordering. Items displayed reflect the current set of security trimmed items retrieved by the query Query is run whenever the page that contains the Part is viewed. If new content is added and it meets the query criteria, the Content Query Web Part automatically displays it. The key elements of the web part are: query, presentation, + any additional filtering. Functionally it works and you provides values OOB, but if you want to query custom content types and/or fields you’ll need to manipulate the *.webpart files It is a powerful new feature that we have found use for in a wide variety of content management/publishing/delivery scenarios

    6. Where we use it Microsoft Web (MSW) Company portal Employees use MSW to find information, stay informed and make productive use of the intranet MS Library (MSL) Library portal Employee’s primary access point to business , marketing & technical research resources Slide Notes: Where we use it? In a word – EVERYWHERE. We serve as the primary design team for three key portals in the company – and consulting/advising on several others. All portals are essentially publishing portals and rely heavily on CQWP across the sites to display filtered views of items stored in sub-site libraries and lists Query Web Parts allow building of dynamic pages w/ centralized content management and consistent formatting List columns can be declared in the Web Part properties and then filtered on for the desired page Slide Notes: Where we use it? In a word – EVERYWHERE. We serve as the primary design team for three key portals in the company – and consulting/advising on several others. All portals are essentially publishing portals and rely heavily on CQWP across the sites to display filtered views of items stored in sub-site libraries and lists Query Web Parts allow building of dynamic pages w/ centralized content management and consistent formatting List columns can be declared in the Web Part properties and then filtered on for the desired page

    7. How we use it Rolling up select items from single/multiple sources Slide Notes Aggregating content across page libraries based on specific content type(s) or field values Slide Notes Aggregating content across page libraries based on specific content type(s) or field values

    8. How we use it: news roll-up Re-using centralized content: custom queries are used to display updated & filtered views of items stored in libraries and lists w/o having to constantly edit pages Automatically building news archives pages by category and publish date w/o manual intervention Slide Notes: In these examples, we display most recent news, article, and calendar events (MSW) using custom queries to provide pages with different views of same data w/o having to constantly edit pages I’ll briefly mention here our use of the “moving window” query (using offset attribute) and style modifications Tab structure is just <div> containers on a single page layout – each w/ its own set of web part zones Top story has related story columns to accommodate up to 3 related stories Recent Top Stories is another query configured to show: <eq> Today – 7 and <neq> Today - 1Slide Notes: In these examples, we display most recent news, article, and calendar events (MSW) using custom queries to provide pages with different views of same data w/o having to constantly edit pages I’ll briefly mention here our use of the “moving window” query (using offset attribute) and style modifications Tab structure is just <div> containers on a single page layout – each w/ its own set of web part zones Top story has related story columns to accommodate up to 3 related stories Recent Top Stories is another query configured to show: <eq> Today – 7 and <neq> Today - 1

    9. How we use it: content filtering Use defined target and status site columns to enable content filtering and display Slide Notes Other examples: Specific topic pages and KB articles by category values (MSL) Recent blog posts/comments by category or item ID (MSL and MSW) Slide Notes Other examples: Specific topic pages and KB articles by category values (MSL) Recent blog posts/comments by category or item ID (MSL and MSW)

    10. How we use it: data presentation Ensuring consistent formatting/presentation across displays Styles are defined according to portal brand guidelines Slide Notes: MSW Industry and World News containers – use XSL to display alternate first row MSW Blog/Calendar rollup – using listoverride property and custom styles MSL Blog and Right-Rail containers – use consistent styles across all pages MSLibrary – notice the use of CQWP in right-rail to supplant local navigation Roll-up of editorially selected items on main page. Filtered views of content in right rail support contextual navigation NOTE: some styles can be re-used via the datacolumnrenames property – which I’ll talk about shortly Slide Notes: MSW Industry and World News containers – use XSL to display alternate first row MSW Blog/Calendar rollup – using listoverride property and custom styles MSL Blog and Right-Rail containers – use consistent styles across all pages MSLibrary – notice the use of CQWP in right-rail to supplant local navigation Roll-up of editorially selected items on main page. Filtered views of content in right rail support contextual navigation NOTE: some styles can be re-used via the datacolumnrenames property – which I’ll talk about shortly

    11. How we use it: content delivery Use the CQWP RSS feature to emit a category-filtered stream of results from news lists Use the created URL on other pages to have more control over design and placement of RSS icon Slide Notes NOTE: RSS XSL can be configured via SharePoint Designer Slide Notes NOTE: RSS XSL can be configured via SharePoint Designer

    12. How we use it: content targeting Targeting select content to specific audiences, like FTEs: Audiences can be defined by SharePoint or security groups, DLs, or rules-based entities Audience targeting is enabled under the Query tab and defined under the Advanced tab of the tool pane. Slide Notes: Feed service is enabled under the Presentation tab Audiencing – useful for FTE-only content targeting, for example NOTE: We’ll talk more about and demo these usage scenarios more in a moment Article reference: Include in add’l resources? RSS configuration reference: http://msdn2.microsoft.com/en-us/library/bb608445.aspx Audience Targeting URL reference: http://office.microsoft.com/en-us/sharepointserver/HA101690531033.aspx Slide Notes: Feed service is enabled under the Presentation tab Audiencing – useful for FTE-only content targeting, for example NOTE: We’ll talk more about and demo these usage scenarios more in a moment Article reference: Include in add’l resources? RSS configuration reference: http://msdn2.microsoft.com/en-us/library/bb608445.aspx Audience Targeting URL reference: http://office.microsoft.com/en-us/sharepointserver/HA101690531033.aspx

    13. OOB Functional Considerations The CQWP is part of the publishing features set so this will need to be activated for the web part to be available in the gallery. NOTE: the part is not available in WSS. It can only query against single-value Lookup or Choice fields It cannot query across site collections It doesn’t support server-side pagination Unlike the Data View Web Part (DVWP) it can easily query across lists within the same site collection Slide Notes This slide is intended to address some of the common questions around usage, availability, and general limitations w/ OOB functionality. Pagination not supported in the data source like a list. You could pull back all items and manage on client-side via JavaScript. This is also where we address the differences between CQWP and DVWP: CQWP supports x-list queries and XSL-based template model for UI customizations/styling. DVWP while it excels @ single-list view customizations it is a one-off customization that must be done each time in SharePoint Designer (SPD). NOTE: the DVWP can technically query across lists if you build a cross-list data source – there’s not one OOTB Slide Notes This slide is intended to address some of the common questions around usage, availability, and general limitations w/ OOB functionality. Pagination not supported in the data source like a list. You could pull back all items and manage on client-side via JavaScript. This is also where we address the differences between CQWP and DVWP: CQWP supports x-list queries and XSL-based template model for UI customizations/styling. DVWP while it excels @ single-list view customizations it is a one-off customization that must be done each time in SharePoint Designer (SPD). NOTE: the DVWP can technically query across lists if you build a cross-list data source – there’s not one OOTB

    14. Before you use start Getting the most out of this web part requires consideration and planning of your content management needs up front Slide Notes Remind folks here that it is important to consider the content organization when leveraging the part. I can’t stress this point enough. This really is the thrust of this talk – not just how to use the part, but how to leverage it from a business application context. This includes augmenting a content type w/ “target” site columns – which in turn can be used as filters for the query. Slide Notes Remind folks here that it is important to consider the content organization when leveraging the part. I can’t stress this point enough. This really is the thrust of this talk – not just how to use the part, but how to leverage it from a business application context. This includes augmenting a content type w/ “target” site columns – which in turn can be used as filters for the query.

    15. CQWP Usage on Microsoft Portals demo Demo Script/Notes Purpose of this demo will be to demonstrate several of the web part uses highlighted earlier on the live portals – MSW and MSLibrary. MSW News – today/past 5d tab w/ queryoverride MSW “What’s Happening” – MSLibrary “Right Rail” MSW – blog comments I created a modified CBQ called InsideMS_Blog_Comments configured as follows: <property name="ListsOverride" type="string"><![CDATA[<Lists><List ID="ea4738a5-0cd6-4ae9-beea-15c2e5e6397e"/></Lists>]]></property> This guid is specifically for the InsideMS blog comments list <property name="DataColumnRenames" type="string">Body,Description;</property> This allows me to display the body field contents w/ a default CBQ style Queryoverride: <OrderBy><FieldRef Name="Created" Ascending="FALSE" /></OrderBy><Where><Eq><FieldRef Name="PostTitle" /><Value Type="Text">MS People Review</Value></Eq></Where> Limit to 5 NOTE: this part is filtering comments based on the post title (and can be easily edited in the CBQ tool part pane). Due to the nature of the blog template (where categories, posts, and comments are all stored in separate lists) filtering on this value may be the only option w/ default settings. It may be possible to edit the comments list schema to include a lookup field to the category list, but I haven’t tried this yet. Demo Script/Notes Purpose of this demo will be to demonstrate several of the web part uses highlighted earlier on the live portals – MSW and MSLibrary. MSW News – today/past 5d tab w/ queryoverride MSW “What’s Happening” – MSLibrary “Right Rail” MSW – blog comments I created a modified CBQ called InsideMS_Blog_Comments configured as follows: <property name="ListsOverride" type="string"><![CDATA[<Lists><List ID="ea4738a5-0cd6-4ae9-beea-15c2e5e6397e"/></Lists>]]></property> This guid is specifically for the InsideMS blog comments list <property name="DataColumnRenames" type="string">Body,Description;</property> This allows me to display the body field contents w/ a default CBQ style Queryoverride: <OrderBy><FieldRef Name="Created" Ascending="FALSE" /></OrderBy><Where><Eq><FieldRef Name="PostTitle" /><Value Type="Text">MS People Review</Value></Eq></Where> Limit to 5 NOTE: this part is filtering comments based on the post title (and can be easily edited in the CBQ tool part pane). Due to the nature of the blog template (where categories, posts, and comments are all stored in separate lists) filtering on this value may be the only option w/ default settings. It may be possible to edit the comments list schema to include a lookup field to the category list, but I haven’t tried this yet.

    16. Anatomy of the CQWP It uses property settings and CAML to construct the query and the SPSiteDataQuery class to query the SharePoint site to gather results. There are a lot of properties available for configuring and customizing the query Fortunately, you don’t need to modify that many of them. To do these more advanced configurations requires modifying the file through file export or SharePoint Designer (SPD). The web part uses three primary XSL files to render aggregated query results. ContentQueryMain, ItemStyle, and Header.xsl NOTE: A fourth XSL file is available for the RSS feed. The default styles can render the following: Title, Description, LinkUrl, and ImageUrl. Slide Notes: Regarding bullet 1: note here that the CQWP is a subclassed DVWP that takes in data and displays it via XSL. Query Construction: There are over 60 properties/methods available for the webpart class, many of which can be customized. That said, there are really only a few key ones you need to understand and use to support over 90% of your use scenarios. Not all of these are exposed in the tool pane. I’ll talk about these more in a minute and how you access them. The Export/Configure/Reinport method is a pain, but once you understand what needs to be configured it’s not so bad – and better to quickly do that via SPD. I’ll also talk about some tricks you can do to minimize this process – and some extensions we made to the web part to facilitate this configuration process. Presentation Construction: MSDN article reference to possibly include @ end of deck: http://msdn2.microsoft.com/en-us/library/bb447557.aspx ContentQueryMain – used to maintain CBQ structure; it receives all the content, parses it, and sends appropriate pieces to the ItemStyle and Header templates. ItemStyle - contains the style templates (row style definitions) defining how to display an item. Data is processed one row at a time, to ensure consistency. Header – contains style templates (Group style definitions) that define how to display the header for a group of returned items. We rarely use or edit this XSL file. All of them contain several functions in the <xsl: variables> section that can be re-used in custom styles. For example OuterTemplate.GetSafeLink function: “When the user passes in the UrlColumnName(the column name containing the ItemUrl value), this function returns a URL that is safe to display to the item. If the URL is not safe to display, the function returns a blank URL.” The defined styles correspond to the options available in the Group and Item style drop-down lists that appear when you choose styles in the Style Library. NOTE: typically we extend the existing files, making copies and adding our own custom styles. This approach allows us to leverage the existing contentquerymain file and easily populate the group/item picklists w/ our style additions. The downside? This makes these styles available to *all* CBQs in the collection and some styles are very site/content-specific. Slide Notes: Regarding bullet 1: note here that the CQWP is a subclassed DVWP that takes in data and displays it via XSL. Query Construction: There are over 60 properties/methods available for the webpart class, many of which can be customized. That said, there are really only a few key ones you need to understand and use to support over 90% of your use scenarios. Not all of these are exposed in the tool pane. I’ll talk about these more in a minute and how you access them. The Export/Configure/Reinport method is a pain, but once you understand what needs to be configured it’s not so bad – and better to quickly do that via SPD. I’ll also talk about some tricks you can do to minimize this process – and some extensions we made to the web part to facilitate this configuration process. Presentation Construction: MSDN article reference to possibly include @ end of deck: http://msdn2.microsoft.com/en-us/library/bb447557.aspx ContentQueryMain – used to maintain CBQ structure; it receives all the content, parses it, and sends appropriate pieces to the ItemStyle and Header templates. ItemStyle - contains the style templates (row style definitions) defining how to display an item. Data is processed one row at a time, to ensure consistency. Header – contains style templates (Group style definitions) that define how to display the header for a group of returned items. We rarely use or edit this XSL file. All of them contain several functions in the <xsl: variables> section that can be re-used in custom styles. For example OuterTemplate.GetSafeLink function: “When the user passes in the UrlColumnName(the column name containing the ItemUrl value), this function returns a URL that is safe to display to the item. If the URL is not safe to display, the function returns a blank URL.” The defined styles correspond to the options available in the Group and Item style drop-down lists that appear when you choose styles in the Style Library. NOTE: typically we extend the existing files, making copies and adding our own custom styles. This approach allows us to leverage the existing contentquerymain file and easily populate the group/item picklists w/ our style additions. The downside? This makes these styles available to *all* CBQs in the collection and some styles are very site/content-specific.

    17. Custom Field Configuration Only a few properties are available directly through the tool pane. To modify the additional properties export the .webpart file and modify in editor of choice, and then modify the .webpart file. Once configured, you can re-import or even upload the modified file to the web part gallery Export to Configure Slide Notes Identify columns and either add to existing or create new content type Add web part and configure query Modify XSL files to expose custom properties (or use datacolumnrename) Import and update reference Slide Notes Identify columns and either add to existing or create new content type Add web part and configure query Modify XSL files to expose custom properties (or use datacolumnrename) Import and update reference

    18. Pertinent Web Part Properties There are only a few key properties we typically configure to expose and our custom content type fields. These properties are used for data retrieval expansion Slide Notes: * As above, note that these are key properties we configure. These two fields are used to expose custom data fields What don’t we use or manipulate: rarely use viewfieldsoverride; rarely touch the header.xsl, etc. Best article reference (added to resources slide): http://msdn2.microsoft.com/en-us/library/aa981241.aspx Slide Notes: * As above, note that these are key properties we configure. These two fields are used to expose custom data fields What don’t we use or manipulate: rarely use viewfieldsoverride; rarely touch the header.xsl, etc. Best article reference (added to resources slide): http://msdn2.microsoft.com/en-us/library/aa981241.aspx

    19. Pertinent Web Part Properties These properties override default behavior Slide Notes: As above, note that these are key properties we configure. Useful for overriding default functionality to expose richer queries or additional list types QueryOverride I have some more detail later in the deck, but I should provide an example here w/ a CDATA block ListsOverride <Lists ServerTemplate="850"></Lists> for pages libraries <Lists BaseType = “1”> for document library (not list libraries) <list ID=“GUID” for specific list instead of all lists of a particular type If you want to get everything based on a Generic List (BaseType = 0), you would use the following property:  <property name="ListsOverride" type="string"><![CDATA[ <Lists BaseType="0"> </Lists>]]></property> If you want to get everything based on a document library (BaseType = 1), you would use the following property:  <property name="ListsOverride" type="string"><![CDATA[ <Lists BaseType="1"> </Lists>]]></property> DataColumnRenames – quick example is mapping blog body field to description to re-use the title/desc default style <property name="DataColumnRenames" type="string">Body,Description;</property> What don’t we use or manipulate: rarely use viewfieldsoverride; rarely touch the header.xsl, etc. Best article reference: http://msdn2.microsoft.com/en-us/library/aa981241.aspxSlide Notes: As above, note that these are key properties we configure. Useful for overriding default functionality to expose richer queries or additional list types QueryOverride I have some more detail later in the deck, but I should provide an example here w/ a CDATA block ListsOverride <Lists ServerTemplate="850"></Lists> for pages libraries <Lists BaseType = “1”> for document library (not list libraries) <list ID=“GUID” for specific list instead of all lists of a particular type If you want to get everything based on a Generic List (BaseType = 0), you would use the following property:  <property name="ListsOverride" type="string"><![CDATA[ <Lists BaseType="0"> </Lists>]]></property>

    20. Pertinent Web Part Properties These properties modify the web part UI only, not the behavior. Slide Notes: * As above, note that these are key properties we configure. These can be useful for fields not provisioned as site columns but present in some listsSlide Notes: * As above, note that these are key properties we configure. These can be useful for fields not provisioned as site columns but present in some lists

    21. Demo CQWP Configuration Export to configure additional properties Demo Script/Notes Purpose of this demo will be to demonstrate several of the properties that can be manipulated and how we use them to solve typical content roll-up scenarios. Export out a MSW news web part: to show how we use commonviewfields and queryoverride properties Export out a blog comments roll-up: to show how to use listoverride and datafieldrename (the blog comments part is not one of the default lists available and to test w/ a standard style you need to map postbody ? description XSL example - <NEED TO SELECT A GOOD EXAMPLE>Demo Script/Notes Purpose of this demo will be to demonstrate several of the properties that can be manipulated and how we use them to solve typical content roll-up scenarios. Export out a MSW news web part: to show how we use commonviewfields and queryoverride properties Export out a blog comments roll-up: to show how to use listoverride and datafieldrename (the blog comments part is not one of the default lists available and to test w/ a standard style you need to map postbody ? description XSL example - <NEED TO SELECT A GOOD EXAMPLE>

    22. Tips/Tricks: General ALL XML inside a <property/> tag must be enclosed in a <![CDATA[ ]]> block. The default web part queries against all page libraries in a site collection. Suggest either changing default to be opt-in instead of opt-out or ensure your site publishing rules accommodate this. Upload to the web part gallery a pre-configured CQWP. Expose custom fields via AdditionalFilterFields to allow for modification via browser Slide Notes: Challenge w/ modifying the default CBQ is one would have to modify the .webpart file located in the /_catalogs/wp folder We provide MSLibrary w/ a number of “canned” CQWP ready to drop and modify directly in the browser. For example, their right-rail uses many of the same queries w/ slightly different filters depending on the page being built. This approach allows them to build/configure/publish pages much more quickly. Slide Notes: Challenge w/ modifying the default CBQ is one would have to modify the .webpart file located in the /_catalogs/wp folder We provide MSLibrary w/ a number of “canned” CQWP ready to drop and modify directly in the browser. For example, their right-rail uses many of the same queries w/ slightly different filters depending on the page being built. This approach allows them to build/configure/publish pages much more quickly.

    23. Tips/Tricks: General Use CQWPs on a hidden page to emit RSS feeds whose URLs can be used elsewhere. Use consistent site columns for content filtering. If your content changes frequently keep the Cross List Query Cache Changes setting to check every time. If you need to query against >1000 lists you can add the MaxListLimit attribute to the ListsOverride property. By default this is set to 1000 There is a performance trade-off here Slide Notes: Comment on RSS – little modification done here We haven’t had need to modify the default Cross List Query Results Multiplier setting (Object Cache Settings) for any of our properties. Slide Notes: Comment on RSS – little modification done here We haven’t had need to modify the default Cross List Query Results Multiplier setting (Object Cache Settings) for any of our properties.

    24. Tips/Tricks: Query Construction Use QueryOverride property for more complex queries The CAML query can have any number of filter fields and values (tool pane is limited to three) CAML Query Schema Reference: http://msdn2.microsoft.com/en-us/library/ms467521.aspx Using OffSetDays attribute to create a “moving window” (toolpane is limited to [Today] or a specified date <OrderBy><FieldRef Name="Modified" Ascending="FALSE" /></OrderBy><Where><Geq><FieldRef ID="Modified" Nullable="True" Type="DateTime"/><Value Type="DateTime"><Today OffsetDays="-45"/></Value> </Geq></Where> Slide Notes: Let audience know about the incomplete search results issue w/ SPSiteDataQuery: http://support.microsoft.com/kb/946484 Slide Notes: Let audience know about the incomplete search results issue w/ SPSiteDataQuery: http://support.microsoft.com/kb/946484

    25. Tips/Tricks: Query Construction Use QueryOverride property for more complex queries You can only have up to two items w/in each <AND> in the <Where> clause: <OrderBy><FieldRef Name="ArticlePublishDate" Ascending="FALSE" /></OrderBy><Where><And><And><And><Geq><FieldRef ID="ArticlePublishDate" Nullable="True" Type="DateTime"/><Value Type="DateTime"><Today OffsetDays="-7"/></Value></Geq><Neq> <FieldRef ID="ArticlePublishDate" Nullable="True" Type="DateTime"/><Value Type="DateTime"><Today /></Value></Neq></And><Eq><FieldRef Name="PublishedIn" /><Value Type="Choice">Home Page</Value></Eq></And><Eq><FieldRef Name="HomePage" /><Value Type="Choice">Top Story</Value></Eq></And></Where> Slide Notes: Let audience know about limits w/in an <AND></AND> clause of 2 – single join.Slide Notes: Let audience know about limits w/in an <AND></AND> clause of 2 – single join.

    26. Tips/Tricks: Query Construction Use ListsOverride property to query against other list types Only list templates available at the site root are enumerated. You can extract a list GUID from the list settings page (replacing %2D w/ a dash) <property name="ListsOverride" type="string"><![CDATA[<Lists><List ID="ea4738a5-0cd6-4ae9-beea-15c2e5e6397e"/></Lists>]]></property> When setting properties requiring use of the column’s internal name remember a space is represented as _x0020_ : <property name="CommonViewFields" type="string"> Project_x0020_Title, Text;Project_x0020_Owner, Text;ProjectNotes, Text</property> Cross list query cannot filter on multi-value lookup or choice fields When filtering on Yes/No data type use the value “1” and not “1” Slides Notes Slides Notes

    27. Tips/Tricks - Presentation Add custom styles to existing XSL files to take advantage of built in functions and template structure Careful to verify before publishing to ensure no malformed XSL XSL files need to be published for reader to view changes Use the datacolumnrenames property to re-use styles Eliminates need to create custom transformations for each custom dataset <![CDATA[<property name="DataColumnRenames" type="string">PostBody,Description</property>]] Slide Notes * Example where we use renames – blog comments w/ list overrideSlide Notes * Example where we use renames – blog comments w/ list override

    28. Tips/Tricks - Presentation To render HTML and not raw tags set the disable-output-escaping attribute to true: <xsl:value-of select="@InternalName" disable-output-escaping="yes"/> NOTE: potential security risk w/ this setting; be sure you trust content. XSL style useful for getting the internal name for a columns <xsl:for-each select="@*"> P:<xsl:value-of select="name()" /> </xsl:for-each> Referencing a Blog post: <a href="{substring-before(@LinkUrl,'/Pages')}/mslibraryblog/Lists/Posts/ViewPost.aspx?ID={@ID}"><xsl:value-of select="@Title" /></a>  <xsl:value-of select="concat(substring(@PublishedDate,6,2), '/', substring(@PublishedDate,9,2), '/', substring(@PublishedDate, 1,4))" />  Other good references: Default Functions: http://msdn2.microsoft.com/en-us/library/bb447557.aspx Heather Solomon: http://www.heathersolomon.com/blog/articles/customitemstyle.aspx

    29. Custom CQWP Examples Modifications we’ve made to the OOB CQWP Override Extension: show additional property fields in the tool pane Dynamic Filtering: allowing overriding query w/ querystring parameter Carousel Display: tool pane options to present results in a rotating display. Source code available on CodePlex: https://www.codeplex.com/Release/ProjectReleases.aspx?ProjectName=sptoolbox&ReleaseId=11150 Slide Notes: Note to audience - we aren’t releasing the carousel part right now.Slide Notes: Note to audience - we aren’t releasing the carousel part right now.

    30. Override Extension Created an extended version with more properties exposed Added a query override call to dynamically update same page contents based on URL parameters Slide Notes Note that w/ our solution the editor doesn’t require the <![CDATA[…]]> block From Solution Documentation on CodePlex Implementation Details In order to override the functionality of the base class and incorporate the new override logic, the CreateChildControls method is overridden. In this method, the CQWP Dynamic QueryOverride calls the overWriteQuery method which does the following: Checks if the customQueryOverride property is not null, if it is, the default QueryOverride will be used and no parameter replacement will occur. Checks if the useQueryString property is set. If it is not, the parameters in the query string will not be replaced in the customQueryOverrride string. For each query string key in the QueryString of the page, the method will do a simple text replace of the {keyName} value in the customQueryOverride string with the value of QueryString[keyName] After the overWriteQuery method is complete, the method sets the CommonViewFields property to the customViewFieldsOverride property and calls the base CreateChildControls. Lastly, the method sets the QueryOverride and CommonViewFields properties to the empty string. Slide Notes Note that w/ our solution the editor doesn’t require the <![CDATA[…]]> block From Solution Documentation on CodePlex Implementation Details In order to override the functionality of the base class and incorporate the new override logic, the CreateChildControls method is overridden. In this method, the CQWP Dynamic QueryOverride calls the overWriteQuery method which does the following: Checks if the customQueryOverride property is not null, if it is, the default QueryOverride will be used and no parameter replacement will occur. Checks if the useQueryString property is set. If it is not, the parameters in the query string will not be replaced in the customQueryOverrride string. For each query string key in the QueryString of the page, the method will do a simple text replace of the {keyName} value in the customQueryOverride string with the value of QueryString[keyName] After the overWriteQuery method is complete, the method sets the CommonViewFields property to the customViewFieldsOverride property and calls the base CreateChildControls. Lastly, the method sets the QueryOverride and CommonViewFields properties to the empty string.

    31. Content Carousel Extension Created an extension to support a filmstrip display of returned results. A preliminary release that we’d like to do more with – we’ll keep the community posted. Slide Notes Slide Notes

    32. demo Custom CQWP: Property Override & Dynamic Filtering DEMO NOTES: Library Newsletter Menu InfoDesk article filter and/or the Books Browse-by-SubjectDEMO NOTES: Library Newsletter Menu InfoDesk article filter and/or the Books Browse-by-Subject

    33. Resources & Related Content Office Visual How To: Displaying Custom Fields in CQWP in Office SharePoint Server 2007: http://msdn2.microsoft.com/en-us/library/bb850574.aspx Configuring CBQ (ECM blog post, G. Perantatos): http://blogs.msdn.com/ecm/archive/2006/10/25/configuring-and-customizing-the-content-query-web-part.aspx How to: customize the CQWP by using Custom Properties (MSDN article): http://msdn2.microsoft.com/en-us/library/aa981241.aspx Building a News Workbench on MOSS 2007 (ECM blog post, S. Squires): http://blogs.msdn.com/ecm/archive/2008/02/19/building-a-news-workbench-on-moss-2007-part-1.aspx

More Related