A problem was recently posted on one of our SharePoint Solutions Help Community Forums. The situation was that an individual wanted to “roll up” multiple discussion boards from multiple sub-sites; essentially pulling the content from different discussion board lists.
One solution is to upgrade to SharePoint 2013 and take advantage of all the new social features such as Communities. Another option is to buy a third-party web part such as this one. Neither of these may be possible in your organization.
In this post, I will present a solution that involves modifying the styles available for presentation within the Content Query Web Part.
The content query web part can roll-up information from multiple sites, based on Content Type. Unfortunately, discussion boards in 2010 are not like most lists. Only the first post in each thread has a “Title.” That first post is the Discussion Content Type, which is actually a folder with metadata. All the replies are Message Content Types within that folder. This means that if you don’t limit the content query to only folder-type content types then you receive many, many items that display “(blank)” for a placeholder for the missing Title field. Another problem is that each of the links will take you to a page with just that single message instead of showing the entire thread. In this age of Facebook and ongoing social dialogue, this setup doesn’t work for most people.
Begin by editing a page, inserting a web part, selecting “content rollup”, and choosing content query.
Edit the web part and set it to query all Discussion Board “Folder Content Types” group from the parent site of the Discussion Boards you want to roll up. In the example below, my discussion boards were in separate subsites of the Production site.
Initially, the Content Query web part looks like this.
Clicking on any of these links take the user to a single page displaying only that message:
Clicking through obviously doesn’t show the whole thread and clicking “close” takes the user back to the page with the query. This is not what most users are expecting.
This is an example of a style. A style is simply a markup template that is applied to the information you give it. The good news is that styles can be added to or modified. Each style is pulled from a specific file on your SharePoint installation, ItemStyles.xsl. So one way to make this look better and act better is to modify those styles. A familiarity with the basics of computer languages and/or markup languages comes in very handy, as I found out. The location of these styles is found in a folder on your top level site in a site collection. If you open up your site with SharePoint Designer and choose the topic of “All Files” in the left-side menu then you will be able to browse to the folder “Style Library” –> “XSL Style Sheets”. In this folder there is a file called “ItemStyle.xsl.” You can edit this item from within Designer. I added the following into this file right before the last /xsl:template tag. Because this is a markup language it gets swallowed up by web browsers in its correct syntax so I couldn’t copy and paste the text in this blog. Here’s an image of the correct lines.
This inserts a new style into the ItemStyle.xsl using the XSL standards. I save the document and return to SharePoint. Now I can choose the style I just created when editing the web part.
So now when I select the “CustomRollup” style I get this:
Not too impressive until we click on one and receive this:
Now we get links that take us to the full discussion with the default view for that discussion, whether flat or threaded. Rather than a “close” button, the browser’s back button will return us to the appropriate page. You can add to the code in order to make it look better. I got a lot of help from W3schools where I learned that XSL was simpler than I thought and from Stackoverflow.com for specific help on getting a hyperlink displayed properly. This instruction set makes much better and more advanced use of XSL to provide an experience in styles.
There are limitations and problems with this solution (just like any other) in that if Microsoft ever chooses to update the file, your custom changes will probably be overwritten without notice. I will continue to play with this and see if I can make it better looking, but I hope this helps you get started on aggregating your discussion boards for a better user experience in SharePoint 2010.