Why is this important? Let me walk you through an applied example. Out of the box on SharePoint 2007, Blogs allow for only a single category. This, of course, sucks. If I write a post about installing SharePoint 2010 on Windows 7, I would like to categorize it as “SharePoint 2010” and “Windows 7”. The workaround is simple and documented (in a video no less) by Lawrence Liu (who has since moved on to Telligent) here: Configuring SharePoint to allow multiple categories per blog post.
This works great, but let’s say that the Sales, Legal, and Marketing teams at Contoso have all established blogs (with multiple categories) on their own web sites, and we would now like to aggregate some of their posts (any posts with a category of Foo) on the front page of our Intranet portal. To do so, we add a Content Query Web Part to the front page, set the scope to our site collection, and filter to show items when Category is equal to Foo.
While this works fine with blogs that only allow a single category, here’s what we get if the Marketing blog has a category of “Foo” and “Bar”.
Frustrating. Waldek Mastykarz (a SharePoint Server MVP out of the Netherlands) has some workarounds to this problem that include custom multi lookup fields or custom XSLT functions.
Enter… SharePoint 2010. First of all, right out of the box you can add multiple categories to a post. The UI below is what you get when creating a post through the web interface, but I still prefer using Windows Live Writer.
What does this do to content queries? Let’s add a content query web part to our front page.
As with 2007, set our source scope to the site collection, with a list type of “Posts”.
We’ll filter to only show blog posts where the category is equal to foo (as before), and we’ll also filter out those “Welcome to your Blog!” posts that nobody remembers to delete.
Voila! The content query (which is being run against a multi-value lookup field) successfully completes. Sweet!
* Disclaimer: SharePoint 2010 is in beta. I’m not on the product team, and for all I know this capability may or may not make it to RTM. This functionality qualifies for Jeff Atwood’s “works on my machine” certification.
*Update: I spoke with a Dev on the SharePoint team, and this will only work in narrow circumstances. The CQWP in SharePoint 2010 will support querying multi-value lookup fields against a single list, or single-value fields in multiple lists, but not both at the same time. It appears that the Category field used by blogs may be an exception to this rule.
Can you set the filter for a date field to return only this MONTH?
I have one question regarding content query. How can I use Custom Query field in it?
Hello, why I did not find the content query 2010, which controls, is the Chinese version of my
Can i able to view more columns in content query webpart
good and Nice post. The way you written is appreciated
I like your Post very much and It is very interesting. I will use this Info to Develop the SharePoint Applications. Thanks for share this valuable Information.
More info on CQWP
When I run the query in 2010 using a term from the termset called Category (this is a [Core Document Column]), the search comes up empty. If I add a custom column to my libraries, and give it the same name Category, but in the CQWP select Category [Core
Document Column], then I get the results. (If I select the custom Category in the CQWP, the search comes back empty).
I don't want to include two Category columns. I want it to work off the managed meta from the termset.