<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Andy Burns' SharePoint Blog &#187; CQWP</title>
	<atom:link href="http://www.novolocus.com/tag/cqwp/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.novolocus.com</link>
	<description>Whatever I'm working on, really...</description>
	<lastBuildDate>Mon, 08 Feb 2010 08:00:22 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Newsticker Web Part for SharePoint</title>
		<link>http://www.novolocus.com/2009/04/20/newsticker-web-part-for-sharepoint/</link>
		<comments>http://www.novolocus.com/2009/04/20/newsticker-web-part-for-sharepoint/#comments</comments>
		<pubDate>Mon, 20 Apr 2009 10:05:09 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[CQWP]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=1317</guid>
		<description><![CDATA[I&#8217;ve written a web part that provides a &#8216;newsticker&#8217; for SharePoint, although it&#8217;ll actually query for news, documents, or anything else you can query for with the Content Query Web Part (CQWP). In fact, it&#8217;s just a configuration of the CQWP, which also uses jQuery for animation and stuff. Typically web sites use this for [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve written a web part that provides a &#8216;newsticker&#8217; for SharePoint, although it&#8217;ll actually query for news, documents, or anything else you can query for with the Content Query Web Part (CQWP). In fact, it&#8217;s just a configuration of the CQWP, which also uses jQuery for animation and stuff. Typically web sites use this for displaying news or announcements, but you can use it to query for any SharePoint content type(s), as you would with the Content Query Web Part. </p>
<p>The Content Query Ticker Web Part looks like this in operation&#8230;</p>
<link rel="stylesheet" href="http://www.novolocus.com/demo/cqtwp/cqticker.css" /><script type="text/javascript" src="http://www.novolocus.com/demo/cqtwp/jquery-1.3.min.js"></script><script type="text/javascript" src="http://www.novolocus.com/demo/cqtwp/cqticker.js"></script><script>$(document).ready(function(){$("#demoTicker").cqticker(4000);});</script>
<div class="cqticker-outer">
<ul id="demoTicker">
<li><span>Group 1 : </span><a>Item A</a> &#8211; Some Description</li>
<li><span>Group 1 : </span><a>Item B</a> &#8211; Some Other Description</li>
<li><span>Group 2 : </span><a>Item C</a> &#8211; Yet Another Description</li>
</ul>
</div>
<p>It does require MOSS 2007, and you do need to enable the Publishing Infrastructure on your site collection.</p>
<p>For more details, <a href="http://www.novolocus.com/software/content-query-ticker-web-part/">see this page.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2009/04/20/newsticker-web-part-for-sharepoint/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Date Formats in SharePoint again</title>
		<link>http://www.novolocus.com/2009/03/26/date-formats-in-sharepoint-again/</link>
		<comments>http://www.novolocus.com/2009/03/26/date-formats-in-sharepoint-again/#comments</comments>
		<pubDate>Thu, 26 Mar 2009 18:09:18 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[CQWP]]></category>
		<category><![CDATA[Dates]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=1198</guid>
		<description><![CDATA[So, I was playing with Date formats again in SharePoint, and came across a  good tip from Panvega worth a shout &#8211; Using ddwrt:FormatDate in the CQWP. I needed to take the Publishing date for a page and reformat it (I don&#8217;t need &#8216;14:55:47 GMT&#8217; on the end); this allowed me to do that!
]]></description>
			<content:encoded><![CDATA[<p>So, I was playing with Date formats again in SharePoint, and came across a  good tip from Panvega worth a shout &#8211; <a href="http://panvega.wordpress.com/2008/12/08/ddwrtformatdate-with-different-formatflags/">Using ddwrt:FormatDate in the CQWP</a>. I needed to take the Publishing date for a page and reformat it (I don&#8217;t need &#8216;14:55:47 GMT&#8217; on the end); this allowed me to do that!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2009/03/26/date-formats-in-sharepoint-again/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CQWP: Show the first item in each group</title>
		<link>http://www.novolocus.com/2009/03/10/cqwp-show-the-first-item-in-each-group/</link>
		<comments>http://www.novolocus.com/2009/03/10/cqwp-show-the-first-item-in-each-group/#comments</comments>
		<pubDate>Tue, 10 Mar 2009 12:00:58 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[CQWP]]></category>
		<category><![CDATA[XSL]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=1134</guid>
		<description><![CDATA[So, we have a customer who has a library of Newsletters.

These newsletters belong to different regions, and they have a date on which they should be &#8216;published&#8217; &#8211; or at least, a date at which they&#8217;re the most recent item. So, we have two columns to capture that &#8211; News Region and Publish Date.
The customer [...]]]></description>
			<content:encoded><![CDATA[<p>So, we have a customer who has a library of Newsletters.</p>
<p><a href="http://www.novolocus.com/wp-content/uploads/2009/03/library-of-newsletters.png"><img class="alignnone size-medium wp-image-1135" title="library-of-newsletters" src="http://www.novolocus.com/wp-content/uploads/2009/03/library-of-newsletters-300x59.png" alt="library-of-newsletters" width="300" height="59" /></a></p>
<p>These newsletters belong to different regions, and they have a date on which they should be &#8216;published&#8217; &#8211; or at least, a date at which they&#8217;re the most recent item. So, we have two columns to capture that &#8211; <em>News Region</em> and <em>Publish Date</em>.</p>
<p>The customer wanted a web part on a page that would show the most recently &#8216;published&#8217; item for each of those regions. Something like:</p>
<p><a href="http://www.novolocus.com/wp-content/uploads/2009/03/result.png"><img class="alignnone size-full wp-image-1136" title="result" src="http://www.novolocus.com/wp-content/uploads/2009/03/result.png" alt="result" width="189" height="79" /></a></p>
<p>I did this with the Content Query Web Part (CQWP) &#8211; but how?</p>
<p>Well, first I set my CQWP to query the list of newsletters. They have a specific content type that I queried for. I filtered items with a <em>Publish Date</em> in the future out &#8211; although not a secure way of preventing users seeing these items, at least it doesn&#8217;t make the obvious.</p>
<p>Next, I set the CQWP to group by <em>News Region</em>, and Sort by descenting <em>Publish Date</em>. So far, so standard &#8211; but it would also return multiple items for each region, and display their title, not their region.</p>
<p>This called for a special Itemstyle, which I added using the technique mentioned before for <a href="http://www.novolocus.com/2009/03/06/link-the-cqwp-to-another-xsl-file/">putting ItemStyles into a different file</a>. This made sense; we&#8217;re not going to use this style extensively, so it&#8217;s best to keep it separate.</p>
<p>Next, I modified my CommonViewFields to bring in the News Region column. <a href="http://msdn.microsoft.com/en-us/library/aa981241.aspx">I&#8217;ve mentioned this before</a>.</p>
<p>Then I wrote my XSL:</p>
<p><a href="http://www.novolocus.com/wp-content/uploads/2009/03/xsl.png"><img class="alignnone size-medium wp-image-1137" title="xsl" src="http://www.novolocus.com/wp-content/uploads/2009/03/xsl-300x189.png" alt="xsl" width="300" height="189" /></a></p>
<p>Take a look at it &#8211; it&#8217;s cool.</p>
<p>Looking at the code, you can see I read the <em>News Region</em> that we&#8217;re looking at into a variable. I then count up the number of preceding nodes which also have the same value for their <em>News Region</em>.</p>
<p>The first node with a particular <em>News Region</em> value will always be the one with the latest <em>Publish Date</em> that isn&#8217;t in the future &#8211; therefore, the most recent one for that region. The count statement won&#8217;t count nodes for other regions, either. So, if it&#8217;s the first, we display it &#8211; using the <em>News Region</em> text, rather than the title. Simple!</p>
<p>(But a bugger of an XSL query to figure out)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2009/03/10/cqwp-show-the-first-item-in-each-group/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Link the CQWP to another XSL File</title>
		<link>http://www.novolocus.com/2009/03/06/link-the-cqwp-to-another-xsl-file/</link>
		<comments>http://www.novolocus.com/2009/03/06/link-the-cqwp-to-another-xsl-file/#comments</comments>
		<pubDate>Fri, 06 Mar 2009 09:30:15 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[CQWP]]></category>
		<category><![CDATA[XSL]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=1119</guid>
		<description><![CDATA[I was going to remind myself of a technique that I&#8217;d seen Liam Cleary use on his blog about importing XSL files into ItemStyles.xsl, but then I noticed that he&#8217;d linked to a far better idea from Brendon Swartz &#8211; you can change the XSL file that the Content Query Web Part presents ItemStyles for. [...]]]></description>
			<content:encoded><![CDATA[<p>I was going to remind myself of a technique that I&#8217;d seen Liam Cleary use on his blog about importing XSL files into ItemStyles.xsl, but then I noticed that he&#8217;d linked to a far better idea from Brendon Swartz &#8211; you can <a href="http://blogs.sharepointguys.com/brendon/sharepoint-2007/programming/connecting-the-cqwp-without-changing-itemstyle-xsl/">change the XSL file that the Content Query Web Part</a> presents ItemStyles for. If you export the Content Query Web Part as an XML file and edit it, you&#8217;ll see a property ItemXslLink. Simply give it a url to the new ItemStyles.xsl file.</p>
<p>Personally, I think this is fantastic. Frequently I have been asked to do custom roll-up of content, with customised display. If you have to add to the standard ItemStyles.xsl, then before long your &#8216;Presentation&#8217; setting for your standard CQWPs is full of highly specific item styles. This way, I can isolate &#8211; nearly hide &#8211; the existance of my much more specific item styles to general users.</p>
<p>And I&#8217;ll say more about what I was doing with it shortly.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2009/03/06/link-the-cqwp-to-another-xsl-file/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Error: CQWP &#8211; RSS feed of non-documents doesn&#8217;t work</title>
		<link>http://www.novolocus.com/2008/11/12/error-cqwp-rss-feed-of-non-documents-doesnt-work/</link>
		<comments>http://www.novolocus.com/2008/11/12/error-cqwp-rss-feed-of-non-documents-doesnt-work/#comments</comments>
		<pubDate>Wed, 12 Nov 2008 12:00:21 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[Content Rollup]]></category>
		<category><![CDATA[CQWP]]></category>
		<category><![CDATA[Error]]></category>
		<category><![CDATA[RSS]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=929</guid>
		<description><![CDATA[This is a pretty weird error. I was doing content roll-up of Announcements lists, to give a unified news channel for our intranet. Naturally, I decided to do this using the Content Query Web Part. I added one, and selected that I wanted to query for the contents of Announcements lists. As I like RSS [...]]]></description>
			<content:encoded><![CDATA[<p>This is a pretty weird error. I was doing content roll-up of Announcements lists, to give a unified news channel for our intranet. Naturally, I decided to do this using the Content Query Web Part. I added one, and selected that I wanted to query for the contents of Announcements lists. As I like RSS feeds, I enabled one, and I added it to my favorite feed-reader.</p>
<p>It worked &#8211; but the links to the announcements themselves didn&#8217;t work. The short summary is that is that it appears RSS feeds from Content Query Web Parts don&#8217;t work when you query for certain types of list.<span id="more-929"></span></p>
<p>What I realised was that there was no server in the URL, so my feed reader&#8217;s link to the item was going to a URL starting:</p>
<p><code>http://_layouts/CopyUtil.aspx?Use=id&amp;amp;Action=dispform ...</code></p>
<p>I&#8217;m now tempted to register the _layouts domain ;p</p>
<p>Anyway, checking in the RSS source showed links to incomplete URLs:</p>
<p><a href="http://www.novolocus.com/wp-content/uploads/2008/10/feedxml.png"><img class="alignnone size-medium wp-image-930" title="feedxml" src="http://www.novolocus.com/wp-content/uploads/2008/10/feedxml-300x102.png" alt="" width="300" height="102" /></a></p>
<p>Hmm. So how to fix it? I did some Googling and found references to <a href="http://blogs.msdn.com/ecm/archive/2006/10/25/configuring-and-customizing-the-content-query-web-part.aspx#1914199">similar URLs</a>, and the solution seemed to be to <a href="http://msmvps.com/blogs/obts/archive/2007/03/27/716595.aspx">modify the ContentQueryMain.xslt </a>file (found in the<em> Style Library</em> &gt;<em> XSL Style Sheets</em>). I couldn&#8217;t see why this should make a difference &#8211; it&#8217;s not to do with the RSS feed &#8211; but I thought I&#8217;d try just incase I&#8217;d misunderstood.</p>
<p>I hadn&#8217;t. It didn&#8217;t work.</p>
<p>I then wondered if the RSS feed worked for a new Content Query Web Part that had just been added to a page. I added one, and enabled the RSS feed. It did work &#8211; the URLs in the links contained the server.</p>
<p>Curious.</p>
<p>I exported both web parts as XML and differenced them. One thing I noticed was that the <strong>UseCopyUtil</strong> setting was <em>false</em> in the working web part, and <em>true</em> in the one that wasn&#8217;t. I changed this to true, imported the web part, and now the URLs had a server at the start. They weren&#8217;t valid URLs still, so I swapped back.</p>
<p>Next, I wondered what would happen if I took the web part with the working RSS feed, and slowly changed it over to the query I wanted to run. Presumably, at some point it would break.</p>
<p>It did. When I selected that I wanted to query for Items in an <em>Announcement</em> list rather than a <em>Pages </em>library. I changed my query back to <em>Pages</em> &#8211; and the RSS feed worked. I tried changing to query for <em>Document</em> libraries &#8211; and the RSS feed worked. Then I tried changing the query to get items from <em>Discussions</em> lists &#8211; and the RSS feed failed again.</p>
<p>I then took a look at the page being used for the RSS feed (<em>feed.aspx</em>). All it was really doing was inheriting from the <strong>Microsoft.SharePoint.Publishing.Internal.CodeBehind.FeedPage</strong> page class. I broke out Reflector, and tried following what was going on inside, but to be honest, it was too complicated, and I couldn&#8217;t be bothered.</p>
<p>Either way, it looks like the Content Query Web Part&#8217;s RSS feed doesn&#8217;t work if you&#8217;re querying for <em>Announcement</em> lists.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2008/11/12/error-cqwp-rss-feed-of-non-documents-doesnt-work/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>CQWP: XSL to show you the fields on an item</title>
		<link>http://www.novolocus.com/2008/11/11/cqwp-xsl-to-show-you-the-fields-on-an-item/</link>
		<comments>http://www.novolocus.com/2008/11/11/cqwp-xsl-to-show-you-the-fields-on-an-item/#comments</comments>
		<pubDate>Tue, 11 Nov 2008 11:24:50 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Content Rollup]]></category>
		<category><![CDATA[CQWP]]></category>
		<category><![CDATA[XSL]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=928</guid>
		<description><![CDATA[A modification on the XSL I&#8217;d used previously &#8211; this gives a more readable presentation, and displays the values:

&#60;xsl:template name="ShowFields" match="Row[@Style='ShowFields']" mode="itemstyle"&#62;
&#60;div style="border:1px #aaa solid;background-color:#eee;margin:5px;padding:5px"&#62;
&#60;xsl:for-each select="@*"&#62;
&#60;xsl:value-of select="name()" /&#62; = &#60;xsl:value-of select="." /&#62;&#60;br /&#62;
&#60;/xsl:for-each&#62;
&#60;/div&#62;
&#60;/xsl:template&#62; 
]]></description>
			<content:encoded><![CDATA[<p>A modification on the XSL <a href="http://www.novolocus.com/2008/07/15/column-names-when-setting-up-the-content-query-web-part/">I&#8217;d used previously</a> &#8211; this gives a more readable presentation, and displays the values:<br />
<code><br />
&lt;xsl:template name="ShowFields" match="Row[@Style='ShowFields']" mode="itemstyle"&gt;<br />
&lt;div style="border:1px #aaa solid;background-color:#eee;margin:5px;padding:5px"&gt;<br />
&lt;xsl:for-each select="@*"&gt;<br />
&lt;xsl:value-of select="name()" /&gt; = &lt;xsl:value-of select="." /&gt;&lt;br /&gt;<br />
&lt;/xsl:for-each&gt;<br />
&lt;/div&gt;<br />
&lt;/xsl:template&gt; </code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2008/11/11/cqwp-xsl-to-show-you-the-fields-on-an-item/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Content Roll-up options Part II &#8211; Content Query Web Part</title>
		<link>http://www.novolocus.com/2008/07/18/content-roll-up-options-part-ii-content-query-web-part/</link>
		<comments>http://www.novolocus.com/2008/07/18/content-roll-up-options-part-ii-content-query-web-part/#comments</comments>
		<pubDate>Fri, 18 Jul 2008 10:00:50 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Content Rollup]]></category>
		<category><![CDATA[CQWP]]></category>
		<category><![CDATA[Web Parts]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=701</guid>
		<description><![CDATA[The Content Query Web Part is the Out-of-Box content roll-up web part in MOSS, and consequently it&#8217;s one of the most widely used.
Here&#8217;s an example of one rollup up the &#8216;Project Documents&#8217; type:
It&#8217;s advantages are:

Can select from an entire Site Collection, a Site and it&#8217;s Sub-Sites, or from a List
Can select by List type
Can filter [...]]]></description>
			<content:encoded><![CDATA[<p>The Content Query Web Part is the Out-of-Box content roll-up web part in MOSS, and consequently it&#8217;s one of the most widely used.</p>
<p>Here&#8217;s an example of one rollup up the &#8216;Project Documents&#8217; type:<a href="http://www.novolocus.com/wp-content/uploads/2008/07/cqwp.png"><img class="alignnone size-medium wp-image-707" title="cqwp" src="http://www.novolocus.com/wp-content/uploads/2008/07/cqwp-300x123.png" alt="Standard content query web part" width="300" height="123" /></a></p>
<p>It&#8217;s advantages are:</p>
<ul>
<li>Can select from an entire Site Collection, a Site and it&#8217;s Sub-Sites, or from a List</li>
<li>Can select by List type</li>
<li>Can filter the results by Content Type, or Metadata field values</li>
<li>Can be configured to do Sorting and Grouping</li>
<li>Can display custom data &#8211; but this is a little complex</li>
</ul>
<p>It&#8217;s disadvantages are:</p>
<ul>
<li>Customising the view is possible, but tricky.The view has to be defined in XSL, and the Content Query Web part configured correctly to get the data you want to display.</li>
<li>No pagination of results &#8211; it&#8217;s just truncated.</li>
<li>The user can&#8217;t select the results order, or add his own filter.</li>
<li>You can&#8217;t query across Site collections.</li>
</ul>
<p>All in all, I&#8217;d say that defining the styles for what you want to display puts this into more a &#8216;development&#8217; task, which isn&#8217;t ideal if you&#8217;re trying to push administration out to your users a bit more.</p>
<p>Also, a major issue as far as I&#8217;m concerned is the lack of pagination. You can limit the number of items shown, but without an link to the next &#8216;page&#8217; of items.</p>
<p>Here&#8217;s an example of a Content Query Web Part showing some custom data (highlighted in yellow):</p>
<p><a href="http://www.novolocus.com/wp-content/uploads/2008/07/cqwp-with-custom-data.png"><img class="alignnone size-medium wp-image-699" title="cqwp-with-custom-data" src="http://www.novolocus.com/wp-content/uploads/2008/07/cqwp-with-custom-data-299x121.png" alt="Content Query Web Part showing custom column data." width="299" height="121" /></a></p>
<p><strong>In short: </strong>Cheap, and available, but has that &#8216;just a bit awkward&#8217; feel to setting it up, and lacks some of the features you&#8217;re likely to want. Often will require someone a bit technical for customisation.<span id="more-701"></span></p>
<p>| <a href="http://www.novolocus.com/2008/07/17/content-roll-up-options-part-i-introduction/">Introduction</a> | <a href="http://www.novolocus.com/2008/07/18/content-roll-up-options-part-ii-content-query-web-part/">Content Query Web Part</a> | <a href="http://www.novolocus.com/2008/07/21/content-roll-up-options-part-iii-data-view-web-part/">Data View Web Part</a> |</p>
<p>| <a href="http://www.novolocus.com/2008/07/22/content-roll-up-options-part-iv-lightning-tools-conductor/">Lightning Conductor Web Part</a> | <a href="http://www.novolocus.com/2008/07/23/content-roll-up-options-part-v-bamboos-list-rollip-web-part/">Bamboo&#8217;s List Roll-Up Web Part</a> | <a href="http://www.novolocus.com/2008/07/24/content-roll-up-options-conclusions/">Conclusions</a> |</p>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2008/07/18/content-roll-up-options-part-ii-content-query-web-part/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Column Names when setting up the Content Query Web Part</title>
		<link>http://www.novolocus.com/2008/07/15/column-names-when-setting-up-the-content-query-web-part/</link>
		<comments>http://www.novolocus.com/2008/07/15/column-names-when-setting-up-the-content-query-web-part/#comments</comments>
		<pubDate>Tue, 15 Jul 2008 12:00:02 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Content Rollup]]></category>
		<category><![CDATA[CQWP]]></category>
		<category><![CDATA[Web Parts]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=696</guid>
		<description><![CDATA[So, I&#8217;ve been asked to do a look at content roll up options in SharePoint, such as the Content Query Web Part (CQWP), and one of the things I&#8217;ve been asked to do is to make it display custom column data. Now, there are lots of articles about this &#8211; on MSDN (here and here), [...]]]></description>
			<content:encoded><![CDATA[<p>So, I&#8217;ve been asked to do a look at content roll up options in SharePoint, such as the Content Query Web Part (CQWP), and one of the things I&#8217;ve been asked to do is to make it display custom column data. Now, there are lots of articles about this &#8211; on MSDN (<a href="http://msdn.microsoft.com/en-us/library/aa981241.aspx">here</a> and <a href="http://msdn.microsoft.com/en-us/library/ms497457.aspx">here</a>), Steven Van de Craen <a href="http://www.microsoft.com/belux/msdn/nl/community/columns/stevenvandecraen/contentquerywebpart.mspx">has an article about it</a>, and there are lots of other articles about it (those were just the best resources I came across in a quick search). &#8216;Cos of that, I won&#8217;t repeat &#8216;em &#8211; I&#8217;ll just summarise the steps:</p>
<ol>
<li>Add extra columns to the selected data (CommonViewFields) by exporting, editing and importing the web. part.</li>
<li>Add a new display format to the ItemsStyle.xsl file.</li>
</ol>
<p>Okay, so I did this, and one of my extra columns of data I wanted to present was shown (&#8216;Project&#8217;), but the<br />
other (&#8216;Project Status&#8217;) wasn&#8217;t. What was going on?</p>
<p>Well, I sort of figured it was the space in the name &#8211; SharePoint does a funny encoding of spaces to <strong>_x0020_ </strong>which is annoying, and often causes errors. Anyway, I opened up SharePoint Manager to check what the field was called internally &#8211; and sure enough, it was called <strong>Project_x0020_Status</strong>. Fair enough, I&#8217;d got the internal name right, but using that still didn&#8217;t work.</p>
<p>I decided in the end to have a look at what the fields the CQWP was retrieving. But how to? I could define my own XSL, but I didn&#8217;t know what use to get the list of fields. Well, I found the answer on <a href="http://www.dotnet6.com/blogs/bart_callaerts/archive/2008/01/07/customizing-the-content-query-webpart.aspx">Bart Callaerts web site</a> (actually, there is another good &#8216;how to customise the CQWP article). Anyway, I&#8217;m shamelessly plagiarising just in case that page in unavailable.</p>
<p>His idea was to define an Item Style to show all the columns of the retrieved items. The code for this is:</p>
<p><code>&lt;xsl:template name="ViewFields" match="Row[@Style='ViewFields']" mode="itemstyle"&gt;<br />
&lt;xsl:for-each select="@*"&gt;<br />
P: &lt;xsl:value-of select="name()" /&gt;<br />
&lt;/xsl:for-each&gt;<br />
&lt;/xsl:template&gt;</code></p>
<p>And you can <a href="http://www.novolocus.com/wp-content/uploads/2008/07/xsl-for-all-columns.txt">download a copy here</a> &#8211; copying and pasting from this page can screw up so of the characters.</p>
<p>Anyway, I used this view to see my items:</p>
<p><a href="http://www.novolocus.com/wp-content/uploads/2008/07/cqwp-showing-all-columns.png"><img class="alignnone size-medium wp-image-698" title="cqwp-showing-all-columns" src="http://www.novolocus.com/wp-content/uploads/2008/07/cqwp-showing-all-columns-300x118.png" alt="" width="300" height="118" /></a></p>
<p>Looking through that list of fields, I saw that the name of my column (according to the CQWP) is now <strong>Project_x005F_x0020_Status</strong>. That&#8217;s a bit strange, and I don&#8217;t know why that&#8217;s happened. I guess that <a href="http://www.sharepointblogs.com/michael/archive/2007/06/28/customizing-the-content-query-web-part-and-custom-item-styles-best-practices.aspx">Michael Hoffer&#8217;s suggestion</a> (don&#8217;t use spaces in the names when you create the columns &#8211; add them later) is a good one &#8211; I reckon it&#8217;d have saved me this trouble!</p>
<p>Anyway, this suggestion worked nicely. I&#8217;ve highlighted my data in yellow:</p>
<p><a href="http://www.novolocus.com/wp-content/uploads/2008/07/cqwp-with-custom-data.png"><img class="alignnone size-medium wp-image-699" title="cqwp-with-custom-data" src="http://www.novolocus.com/wp-content/uploads/2008/07/cqwp-with-custom-data-299x121.png" alt="Content Query Web Part showing custom column data." width="299" height="121" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2008/07/15/column-names-when-setting-up-the-content-query-web-part/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting ListItems from throughout the Site Collection with SPSiteDataQuery</title>
		<link>http://www.novolocus.com/2008/04/15/getting-listitems-from-throughout-the-site-collection-with-spsitedataquery/</link>
		<comments>http://www.novolocus.com/2008/04/15/getting-listitems-from-throughout-the-site-collection-with-spsitedataquery/#comments</comments>
		<pubDate>Tue, 15 Apr 2008 12:17:05 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Content Rollup]]></category>
		<category><![CDATA[CQWP]]></category>
		<category><![CDATA[SharePoint 2007 Development]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=464</guid>
		<description><![CDATA[So, recently I was doing some work with SharePoint Web Services, getting possible values for Lookup fields. One of the functions I was using was GetListItems(), to get the values that the lookup field could take.
The method&#8217;s signature is:
Lists.GetListItems( [List], [ViewName], [Query], [ViewFields], [RowLimit], [QueryOptions], [WebID]);
I&#8217;m not going to talk about most of these parameters [...]]]></description>
			<content:encoded><![CDATA[<p>So, recently <a href="http://www.novolocus.com/2008/04/07/duplicate-rows-from-the-sharepoint-lists-webservice/">I was doing some work with SharePoint Web Services</a>, getting possible values for Lookup fields. One of the functions I was using was <a href="http://msdn2.microsoft.com/en-us/library/lists.lists.getlistitems.aspx"><strong>GetListItems()</strong></a>, to get the values that the lookup field could take.</p>
<p>The method&#8217;s signature is:</p>
<p><code>Lists.GetListItems(<em> [List], [ViewName], [Query], [ViewFields], [RowLimit], [QueryOptions], [WebID]</em>);</code></p>
<p>I&#8217;m not going to talk about most of these parameters &#8211; <a href="http://msdn2.microsoft.com/en-us/library/lists.lists.getlistitems.aspx">you can read about them here</a>. For my query, most of these parameters were Null (i.e. they were unused). However, the [List] parameter interested me. It&#8217;s the &#8216;Name&#8217; of the list, though I prefer using a GUID (a unique ID) for the list.</p>
<p>The lookup column I was using was defined in a different site to the one where I was making the <strong>GetListItems </strong>call. I&#8217;d pass the GUID, and get the correct values back. My call actually was:</p>
<p><code>XmlNode resultNode = _lists.GetListItems( listGuid, null, null, viewFields, null, null, null);</code></p>
<p>So, this query was finding the correct list elsewhere in the site collection based only on the GUID. Interesting &#8211; I&#8217;m not passing a WebID, and the list is outside the site I&#8217;m currently using the web services of. This set me thinking &#8211; clearly the call was selecting by list GUID against a table of all ListItems in the site collection.</p>
<p>I was a little surprised &#8211; then it hit me &#8211; the Content Query Web Part also does that. But how?</p>
<p>Well, a bit of searching later and I found the <a href="http://msdn2.microsoft.com/en-us/library/microsoft.sharepoint.spsitedataquery.aspx">SPSiteDataQuery </a>object. The object is used for queries against multiple lists in multiple sites. You can specify the types of list to query, values to filter, order by, display, etc.. I&#8217;m pretty sure that this is what the Content Query Web Part uses.</p>
<p>Neat! Now I just need to find a reason to use it!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2008/04/15/getting-listitems-from-throughout-the-site-collection-with-spsitedataquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Content Query Web Parts and Site Categories</title>
		<link>http://www.novolocus.com/2007/03/09/content-query-web-parts-and-site-categories/</link>
		<comments>http://www.novolocus.com/2007/03/09/content-query-web-parts-and-site-categories/#comments</comments>
		<pubDate>Fri, 09 Mar 2007 14:03:28 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Admin]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Content Rollup]]></category>
		<category><![CDATA[CQWP]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=81</guid>
		<description><![CDATA[Here&#8217;s a thought &#8211; wouldn&#8217;t it be cool to have a way of getting content from Sites in a Site Collection, but filtered by their category data?
At the moment, the Content Query Web Part gives you 3 options as to what sites it queries:

A specific site
This site and its children
All sites in the collection

Wouldn&#8217;t it [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a thought &#8211; wouldn&#8217;t it be cool to have a way of getting content from Sites in a Site Collection, but filtered by their category data?</p>
<p>At the moment, the Content Query Web Part gives you 3 options as to what sites it queries:</p>
<ol>
<li>A specific site</li>
<li>This site and its children</li>
<li>All sites in the collection</li>
</ol>
<p>Wouldn&#8217;t it be great, though, to form that list of target sites based on a category? For example, in a big company it may have a number of divisions, each with their own &#8216;Finance&#8217; department. A content query web part that could show content from all the &#8216;Finance&#8217; category sites across the organisation would be very cool.</p>
<p>Can&#8217;t see a way of doing it at the moment though. I suppose I could write my own web-part &#8211; but the Content Query Web Part gives you so much already, I don&#8217;t want to have to replicate that.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2007/03/09/content-query-web-parts-and-site-categories/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
