<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Andy Burns' SharePoint Blog</title>
	
	<link>http://www.novolocus.com</link>
	<description>Whatever I'm working on, really...</description>
	<lastBuildDate>Wed, 15 Feb 2012 09:42:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/novolocus" /><feedburner:info uri="novolocus" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>novolocus</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>Working with the TaxonomyClientService: Part 2 – Get the TermSet (and understand it!)</title>
		<link>http://feedproxy.google.com/~r/novolocus/~3/GF3u93R1T4I/</link>
		<comments>http://www.novolocus.com/2012/02/09/working-with-the-taxonomyclientservice-part-2-get-the-termset-and-understand-it/#comments</comments>
		<pubDate>Thu, 09 Feb 2012 14:00:19 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Development 2010]]></category>
		<category><![CDATA[Taxonomy]]></category>
		<category><![CDATA[Web Services]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=2253</guid>
		<description><![CDATA[In Part 1 I looked at the structure of our Taxonomy field &#8211; which is in fact two fields. We also saw how the TaxonomyField definition has an array of properties related to it too. As a reminder, here&#8217;s a &#8230; <a href="http://www.novolocus.com/2012/02/09/working-with-the-taxonomyclientservice-part-2-get-the-termset-and-understand-it/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://www.novolocus.com/2012/02/06/working-with-the-taxonomyclientservice-part-1-what-fields-are-there/">Part 1</a> I looked at the structure of our Taxonomy field &#8211; which is in fact two fields. We also saw how the TaxonomyField definition has an array of properties related to it too. As a reminder, here&#8217;s a screenshot of the XML for it:</p>
<p><a href="http://www.novolocus.com/wp-content/uploads/2012/01/TaxonomyField-Definition-in-CAML.png"><img class="alignnone size-medium wp-image-2249" title="TaxonomyField Definition in CAML" src="http://www.novolocus.com/wp-content/uploads/2012/01/TaxonomyField-Definition-in-CAML-300x133.png" alt="" width="300" height="133" /></a></p>
<p>These properties are quite important, as they tell us what we need to know to get the correct TermSet for our field.<span id="more-2253"></span></p>
<p>If you look in the properties you&#8217;ll see:</p>
<ul>
<li><strong>SspId</strong> &#8211; The ID of the Managed Metadata Service containing the TermSet for this field. This ID is also sometimes referred to as the TermStore ID.</li>
<li><strong>TermSetId</strong> - The ID of the TermSet for this field.</li>
</ul>
<p><a href="http://www.novolocus.com/wp-content/uploads/2012/01/Properties.png"><img class="alignnone size-medium wp-image-2254" title="Properties" src="http://www.novolocus.com/wp-content/uploads/2012/01/Properties-300x40.png" alt="" width="300" height="40" /></a></p>
<p>With this information we can use the <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.taxonomy.webservices.taxonomyclientservice.gettermsets.aspx"><strong>GetTermSets</strong> </a>method of the <strong>TaxonomyClientService</strong>. (The code below is based on &#8220;<a href="http://sharepointblog.virtosoftware.com/blogs/virtoteam/archive/2011/04/29/working-with-the-managed-metadata-service-remotely.aspx">Working with the Managed Metadata Service Remotely</a>&#8221; by Virtosoft.</p>
<pre class="brush: csharp; title: ; notranslate">string clientTimestamps = string.Format(&quot;&lt;timeStamp&gt;{0}&lt;/timeStamp&gt;&quot;, clientTime);
string clientVersion = &quot;&lt;version&gt;1&lt;/version&gt;&quot;;
string termStoreIds = string.Format(&quot;&lt;termStoreId&gt;{0}&lt;/termStoreId&gt;&quot;, termStoreId.ToString(&quot;D&quot;));
string termSetIds = string.Format(&quot;&lt;termSetId&gt;{0}&lt;/termSetId&gt;&quot;, termSetId.ToString(&quot;D&quot;));
string serverTermSetTimestampXml;
string result = _wssTax.GetTermSets(termStoreIds, termSetIds, 1033, clientTimestamps, clientVersion, out serverTermSetTimestampXml);</pre>
<p>So, there are a lot of parameters to that call &#8211; I&#8217;ll deal with them in part 3, which will be about caching. You&#8217;ll note that you can retrieve multiple termsets from multiple termstores &#8211; I think. I&#8217;ve not tried it (I&#8217;d rather make several calls and keep things simple).</p>
<p>Let&#8217;s look on what we get back from the service:</p>
<p><a href="http://www.novolocus.com/wp-content/uploads/2012/02/Results-of-GetTermSets.png"><img class="alignnone size-medium wp-image-2256" title="Results of GetTermSets" src="http://www.novolocus.com/wp-content/uploads/2012/02/Results-of-GetTermSets-300x161.png" alt="" width="300" height="161" /></a></p>
<p>Nice. So much for XML being human readable. So what&#8217;s this about?</p>
<p>First off, notice that there&#8217;s no nesting. All Terms are returned in a flat list:</p>
<p><a href="http://www.novolocus.com/wp-content/uploads/2012/02/Term-in-Results.png"><img class="alignnone size-medium wp-image-2257" title="Term in Results" src="http://www.novolocus.com/wp-content/uploads/2012/02/Term-in-Results-300x30.png" alt="" width="300" height="30" /></a></p>
<p>The elements of the terms are:</p>
<ul>
<li><strong>TS</strong> &#8211; Term Set</li>
<li><strong>T</strong> &#8211; The Term.</li>
<li><strong>LS</strong> &#8211; Label Set</li>
<li><strong>TL</strong> &#8211; Term Label. Potentially a Term can have several labels, for different Languages</li>
<li><strong>TMS</strong> &#8211; More Term Set Information</li>
<li><strong>TM</strong> &#8211; Term Information</li>
<li><strong>TD</strong> &#8211; Term Description</li>
</ul>
<p>The attributes are all numbered, which is really helpful. What do they mean?</p>
<ul>
<li><strong>a9</strong> &#8211; Term ID or TermSet ID</li>
<li><strong>a11</strong> &#8211; TermSet Description</li>
<li><strong>a12</strong> &#8211; Term Set Name the Term belongs to</li>
<li><strong>a16</strong> &#8211; Submission Policy (Is the termset open or closed)</li>
<li><strong>a17</strong> &#8211; Term is Enabled (can be used for tagging)</li>
<li><strong>a21</strong> &#8211; (boolean) False if the term is not deprecated</li>
<li><strong>a24</strong> &#8211; Term Set ID the Term belongs to</li>
<li><strong>a25</strong> &#8211; Parent Term ID</li>
<li><strong>a31</strong> &#8211; (boolean) Not sure, I think this is true if it&#8217;s the default term label?</li>
<li><strong>a32</strong> &#8211; Label Text</li>
<li><strong>a40</strong> &#8211; Parent Term Name</li>
<li><strong>a45</strong> &#8211; A semicolon separated list of the IDs of the Terms to the current term&#8217;s location in the taxonomy. (I.e. its path!)</li>
<li><strong>a61</strong> &#8211; (integer) ?</li>
<li><strong>a67</strong> &#8211; ?</li>
<li><strong>a68</strong> &#8211; TermSet contact email</li>
</ul>
<p>Nice and simple, eh?</p>
<p>Still, using this information you can determine the structure of the termset. In Part 3, we&#8217;ll look at caching.</p>
<img src="http://feeds.feedburner.com/~r/novolocus/~4/GF3u93R1T4I" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2012/02/09/working-with-the-taxonomyclientservice-part-2-get-the-termset-and-understand-it/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.novolocus.com/2012/02/09/working-with-the-taxonomyclientservice-part-2-get-the-termset-and-understand-it/</feedburner:origLink></item>
		<item>
		<title>Working with the TaxonomyClientService: Part 1 – What fields are there?</title>
		<link>http://feedproxy.google.com/~r/novolocus/~3/O2Q2cF6TgN8/</link>
		<comments>http://www.novolocus.com/2012/02/06/working-with-the-taxonomyclientservice-part-1-what-fields-are-there/#comments</comments>
		<pubDate>Mon, 06 Feb 2012 14:00:37 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Development 2010]]></category>
		<category><![CDATA[Taxonomy]]></category>
		<category><![CDATA[Web Services]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=2248</guid>
		<description><![CDATA[I have been working on an integration that needs to read terms from SharePoint&#8217;s Managed Metadata service, for a particular field, and then populate that field with those values. All this has to be done via SharePoint&#8217;s web services &#8211; &#8230; <a href="http://www.novolocus.com/2012/02/06/working-with-the-taxonomyclientservice-part-1-what-fields-are-there/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I have been working on an integration that needs to read terms from SharePoint&#8217;s Managed Metadata service, for a particular field, and then populate that field with those values. All this has to be done via SharePoint&#8217;s web services &#8211; so the relevant ones here are the <strong><a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.taxonomy.webservices.taxonomyclientservice.aspx">TaxonomyClientService</a>,</strong> and <strong><a href="http://msdn.microsoft.com/en-us/library/ie/websvclists.lists.aspx">Lists </a></strong>web service.</p>
<p>This has proved particularly bloody hard.<span id="more-2248"></span></p>
<p>To start with, let&#8217;s look at what fields I needed to deal with. When you add a Taxonomy column to a list, it actually adds two columns.</p>
<p>The first is your &#8216;display&#8217; column, and this can actually be one of two types &#8211; <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.taxonomy.taxonomyfield.aspx">TaxonomyFieldType </a>or TaxonomyFieldTypeMulti. As the name suggests, these are for single select and multi-select respectively.</p>
<p><a href="http://www.novolocus.com/wp-content/uploads/2012/01/TaxonomyField-Definition-in-CAML.png"><img class="alignnone size-large wp-image-2249" title="TaxonomyField Definition in CAML" src="http://www.novolocus.com/wp-content/uploads/2012/01/TaxonomyField-Definition-in-CAML-1024x454.png" alt="" width="584" height="258" /></a></p>
<p>The second column is a hidden field of the &#8216;Notes&#8217; type. This stores your actual data, it appears, though quite why still mystifies me a bit (more on that later).</p>
<p><a href="http://www.novolocus.com/wp-content/uploads/2012/01/Hidden-Field-Definition-in-CAML.png"><img class="alignnone size-large wp-image-2250" title="Hidden Field Definition in CAML" src="http://www.novolocus.com/wp-content/uploads/2012/01/Hidden-Field-Definition-in-CAML-1024x24.png" alt="" width="584" height="13" /></a></p>
<p>Anyway, there are two columns. As you can see from the screenshots above, the Taxonomy column contains an array of customisation properties.</p>
<p>So, how are these two fields related? Well, not using the &#8216;RelatedField&#8217; attribute (too obvious), and when I did a bit of a search I kept finding blog posts saying that I would have one field with the name I gave it, and another field with the same number but ending with an additional &#8220;TaxHTField0&#8243; text. This was not the behaviour that I saw; it might have changed in a service pack.</p>
<p>On my system, the second (Notes) field seemed to have a GUID-like name. It looked mostly hexidecimal, but was often prefixed by a couple of non-hex characters. At first I thought that this might be the reference between the two fields.</p>
<p>However, the relationship is in fact one of the array of properties on the field:</p>
<p><a href="http://www.novolocus.com/wp-content/uploads/2012/01/TextField-Property.png"><img class="alignnone size-medium wp-image-2251" title="TextField Property" src="http://www.novolocus.com/wp-content/uploads/2012/01/TextField-Property-300x15.png" alt="" width="300" height="15" /></a></p>
<p>The TextField property contains the ID of the Notes Field. Great, that&#8217;s nice and simple.</p>
<p>So, in summary, the relationship between the TaxonomyField and Notes field is held in the TextField property in the array of properties of the TaxonomyField. The value is the ID of the Notes field. You can get this information a variety of ways, but I used the GetListContentType method of the Lists web service.</p>
<p>In <a href="http://www.novolocus.com/2012/02/09/working-with-the-taxonomyclientservice-part-2-get-the-termset-and-understand-it/">Part 2</a> we&#8217;ll look at getting and interpreting the TermSet for our field.</p>
<img src="http://feeds.feedburner.com/~r/novolocus/~4/O2Q2cF6TgN8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2012/02/06/working-with-the-taxonomyclientservice-part-1-what-fields-are-there/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.novolocus.com/2012/02/06/working-with-the-taxonomyclientservice-part-1-what-fields-are-there/</feedburner:origLink></item>
		<item>
		<title>SafeControls Entries in Manifest can be changed during deployment</title>
		<link>http://feedproxy.google.com/~r/novolocus/~3/-tgs898l6rI/</link>
		<comments>http://www.novolocus.com/2012/01/16/safecontrols-entries-in-manifest-can-be-changed-during-deployment/#comments</comments>
		<pubDate>Mon, 16 Jan 2012 17:20:42 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Development 2010]]></category>
		<category><![CDATA[Assemblies]]></category>
		<category><![CDATA[SPWebConfigModification]]></category>
		<category><![CDATA[Web Parts]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=2234</guid>
		<description><![CDATA[I had a slightly unusual situation. We&#8217;ve a customer who has using the Telerik RadEditor version 4.5.6 for SharePoint 2007. They&#8217;re upgrading to SharePoint 2010, and want their existing content to continue to work. They&#8217;ve using the Telerik RadEditor web part &#8230; <a href="http://www.novolocus.com/2012/01/16/safecontrols-entries-in-manifest-can-be-changed-during-deployment/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I had a slightly unusual situation. We&#8217;ve a customer who has using the <a href="http://www.telerik.com/products/sharepoint/overview.aspx">Telerik RadEditor </a>version 4.5.6 for SharePoint 2007. They&#8217;re upgrading to SharePoint 2010, and want their existing content to continue to work.</p>
<p>They&#8217;ve using the Telerik RadEditor web part quite a lot, so we had to keep that working. We&#8217;ve put in Assembly Binding Redirects using an <strong>SPWebConfigModification</strong> (more on that in a later post).</p>
<p>However, we also needed to put in the <a href="http://msdn.microsoft.com/en-us/library/ms451053.aspx">SafeControl </a>entry for the <strong>old</strong> assembly. <span id="more-2234"></span>Maurice Prather <a href="http://www.bluedoglimited.com/SharePointThoughts/Lists/Posts/Post.aspx?ID=311">discusses this here</a>. The short of it is:</p>
<blockquote>
<div>What happens to your Web Part when it&#8217;s redirected to version Y?</div>
<ol>
<li>On <em><strong>first </strong></em>render of a redirected Web Part instance (this is a KEY thing to remember), if the SafeControl for version X exists, an attempt to load the Web Part is made.</li>
<li>The .NET framework kicks in and redirect to version Y is successfully made.</li>
<li>SharePoint notices that the Web Part type guid (nothing we the Web Part developers can explicitly control) has changed and saves the new type id back to the database.</li>
<li>From that point forward, the next time the Web Part is loaded, the call is made directly for version Y.</li>
</ol>
<p>Take a look at step #3.  This is key.  The database actually contains a reference to your web part in a form of a guid.  The guid is a calculated value that allows the SafeMode parser to rapidly associate the serialized form with a live class type.  The important thing to remember is that this reference lives on a per-page reference (i.e. page ABC has reference to web part types M, Q, V).</p>
<p>Why is this important?  Until all instances of Web Part version X have been rendered, you cannot remove the SafeControl reference to version X unless you want bindingRedirect to fail.</p></blockquote>
<p>Okay, fine. That makes sense, and I don&#8217;t have a problem marking a web part that we&#8217;ve been using for ages as safe, even if it will ultimately be updated in all instances by the redirection.</p>
<p>So, I put a new SafeControl entry into on the SharePoint Project Items of my solution.</p>
<p><em>(Please note: below I&#8217;ve used an assembly called &#8216;MyAssembly&#8217;. I&#8217;ve changed the name from the real assembly &#8216;cos I&#8217;m not sure I&#8217;m allowed to talk about it. But I&#8217;m showing the behaviour I saw).</em></p>
<p><a href="http://www.novolocus.com/wp-content/uploads/2012/01/Safe-Control-Entry-Dialog-Box.png"><img class="alignnone size-medium wp-image-2237" title="Safe Control Entry Dialog Box" src="http://www.novolocus.com/wp-content/uploads/2012/01/Safe-Control-Entry-Dialog-Box-300x143.png" alt="" width="300" height="143" /></a></p>
<p>This was then included in my Manifest:</p>
<p><a href="http://www.novolocus.com/wp-content/uploads/2012/01/Correct-In-Manifest.png"><img class="alignnone size-large wp-image-2235" title="Correct In Manifest" src="http://www.novolocus.com/wp-content/uploads/2012/01/Correct-In-Manifest-1024x149.png" alt="" width="584" height="84" /></a></p>
<p>However, when I went and checked the web.config I saw:</p>
<p><a href="http://www.novolocus.com/wp-content/uploads/2012/01/incorrect-web-config-entry.png"><img class="alignnone size-full wp-image-2238" title="incorrect web config entry" src="http://www.novolocus.com/wp-content/uploads/2012/01/incorrect-web-config-entry.png" alt="" width="747" height="56" /></a></p>
<p>WTF? As best as I can determine, the assembly information in my SafeControls entry in my solution&#8217;s manifest has been <em>ignored</em>. The entry in the manifest lives within a particular Assembly element, so presumably SharePoint itself chooses to read the information from the assembly, rather than the manifest! (Why ask for the information then?)</p>
<p>Consequently, I found that the best option I had was to write an <a href="http://msdn.microsoft.com/en-us/library/bb861909.aspx"><strong>SPWebConfigModification</strong> </a>to add my Safe Control entry. And that worked nicely.</p>
<p><strong>Conclusion</strong>: If your WSP doesn&#8217;t contain the assembly you&#8217;re trying to create a SafeControl entry for, you&#8217;ll probably need to use an <strong>SPWebConfigModification</strong>. That seems a shame, given that Visual Studio 2010 appears to let you create other Safe Control entries, and puts them into the manifest correctly.</p>
<img src="http://feeds.feedburner.com/~r/novolocus/~4/-tgs898l6rI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2012/01/16/safecontrols-entries-in-manifest-can-be-changed-during-deployment/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.novolocus.com/2012/01/16/safecontrols-entries-in-manifest-can-be-changed-during-deployment/</feedburner:origLink></item>
		<item>
		<title>Attaching Visual Studio 2010 to Outlook 2010 plugin for Debugging</title>
		<link>http://feedproxy.google.com/~r/novolocus/~3/q5KGnOYsaW0/</link>
		<comments>http://www.novolocus.com/2012/01/12/attaching-visual-studio-2010-to-outlook-2010-plugin-for-debugging/#comments</comments>
		<pubDate>Thu, 12 Jan 2012 10:47:49 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Outlook]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=2229</guid>
		<description><![CDATA[I was trying to attach a debugger to an Outlook plugin I was working on. It was originally written for Outlook 2003, but has been progressively upgraded to 2010. However, I couldn&#8217;t breakpoint my code, or rather, the breakpoints weren&#8217;t &#8230; <a href="http://www.novolocus.com/2012/01/12/attaching-visual-studio-2010-to-outlook-2010-plugin-for-debugging/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I was trying to attach a debugger to an Outlook plugin I was working on. It was originally written for Outlook 2003, but has been progressively upgraded to 2010. However, I couldn&#8217;t breakpoint my code, or rather, the breakpoints weren&#8217;t being hit.</p>
<p>Found <a href="http://stackoverflow.com/questions/3198262/difficulty-starting-vs-2010-debugger-attached-to-outlook-to-debug-plugin">the answer on Stack Overflow</a>:</p>
<blockquote><p>So it turns out that Outlook doesn&#8217;t load the CLR on startup (it must be loaded shortly thereafter when it becomes necessary), which apparently confuses the VS debugger and causes it to only debug native code. To force it to load the CLR immediately, create an OUTLOOK.EXE.config file in the same folder with:</p></blockquote>
<p><code>&lt;configuration&gt; &lt;startup&gt; &lt;supportedRuntime version="v2.0.50727"/&gt;  &lt;/startup&gt;&lt;/configuration&gt;</code></p>
<blockquote><p>which is from this <a href="http://www.analogousmember.com/archives/000394.html">blog post</a>. Then, even when VS starts attached, it will debug CLR code</p></blockquote>
<img src="http://feeds.feedburner.com/~r/novolocus/~4/q5KGnOYsaW0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2012/01/12/attaching-visual-studio-2010-to-outlook-2010-plugin-for-debugging/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.novolocus.com/2012/01/12/attaching-visual-studio-2010-to-outlook-2010-plugin-for-debugging/</feedburner:origLink></item>
		<item>
		<title>Run SPDisposeCheck as part of your build process</title>
		<link>http://feedproxy.google.com/~r/novolocus/~3/KIFii-3Mevw/</link>
		<comments>http://www.novolocus.com/2011/12/05/run-spdisposecheck-as-part-of-your-build-process/#comments</comments>
		<pubDate>Mon, 05 Dec 2011 15:00:30 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Development 2010]]></category>
		<category><![CDATA[MSBuild]]></category>
		<category><![CDATA[SPDisposeCheck]]></category>
		<category><![CDATA[TFS]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=2210</guid>
		<description><![CDATA[As mentioned before, I&#8217;ve been automating the building and analysis of our SharePoint code, and this led me to ask, can you run SPDisposeCheck as part of a TFS build process? Yes we can. Richard Fennell has a concise and &#8230; <a href="http://www.novolocus.com/2011/12/05/run-spdisposecheck-as-part-of-your-build-process/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>As mentioned before, I&#8217;ve been automating the building and analysis of our SharePoint code, and this led me to ask, can you run SPDisposeCheck as part of a TFS build process?</p>
<p>Yes we can. Richard Fennell has a concise and <a href="http://msmvps.com/blogs/rfennell/archive/2010/07/03/running-spdisposecheck-as-part-of-a-2010-ci-build.aspx">simple description of how to do it</a>. It&#8217;s best to read that, but in case that site goes down, the short of it is &#8211; use <strong>InvokeProcess</strong> to run SPDisposeCheck, and it&#8217;ll return a value that is the number of errors/warnings it finds. I find that that&#8217;s enough to choose whether to write a warning to the output of the build, and I don&#8217;t then parse and write the individual warnings into the build. These should be captured by the build log, and they&#8217;re pretty obvious, so it doesn&#8217;t seem worth the hassle. You could do it if you really wanted to.</p>
<p><a href="http://www.novolocus.com/wp-content/uploads/2011/11/build-result-with-SPDisposeCheck.png"><img class="alignnone size-medium wp-image-2216" title="build result with SPDisposeCheck" src="http://www.novolocus.com/wp-content/uploads/2011/11/build-result-with-SPDisposeCheck-234x300.png" alt="" width="234" height="300" /></a></p>
<p>Don&#8217;t forget you can <a title="Practical SPDisposeCheck – Namespaces, Delegates and RootWebs" href="http://www.novolocus.com/2011/06/01/practical-spdisposecheck-namespaces-delegates-and-rootwebs/">use attributes to prevent false positives</a> &#8211; though I still have issues with anonymous delegates that are false positives (how do you add the attributes?), and that&#8217;s what&#8217;s causing the two warnings above.</p>
<img src="http://feeds.feedburner.com/~r/novolocus/~4/KIFii-3Mevw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2011/12/05/run-spdisposecheck-as-part-of-your-build-process/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.novolocus.com/2011/12/05/run-spdisposecheck-as-part-of-your-build-process/</feedburner:origLink></item>
		<item>
		<title>Publishing Navigation without the Publishing…</title>
		<link>http://feedproxy.google.com/~r/novolocus/~3/pAFv1W99TZY/</link>
		<comments>http://www.novolocus.com/2011/12/02/publishing-navigation-without-the-publishing/#comments</comments>
		<pubDate>Fri, 02 Dec 2011 09:17:14 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Admin 2010]]></category>
		<category><![CDATA[Features]]></category>
		<category><![CDATA[Navigation]]></category>
		<category><![CDATA[Publishing]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=2220</guid>
		<description><![CDATA[Recently, a few of our customer&#8217;s systems that I&#8217;ve looked at have had the Publishing Infrastucture site collection feature activated, but purely for the top navigation. That seemed quite a heavyweight approach to me. The Publishing Infrastructure converts the editing &#8230; <a href="http://www.novolocus.com/2011/12/02/publishing-navigation-without-the-publishing/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Recently, a few of our customer&#8217;s systems that I&#8217;ve looked at have had the Publishing Infrastucture site collection feature activated, but purely for the top navigation. That seemed quite a heavyweight approach to me.<span id="more-2220"></span></p>
<p>The Publishing Infrastructure converts the editing experience for the top navigation from this:</p>
<p><a href="http://www.novolocus.com/wp-content/uploads/2011/12/Team-Site-Navigation.png"><img class="alignnone size-medium wp-image-2224" title="Team Site Navigation" src="http://www.novolocus.com/wp-content/uploads/2011/12/Team-Site-Navigation-300x165.png" alt="" width="300" height="165" /></a></p>
<p>Into this:</p>
<p><a href="http://www.novolocus.com/wp-content/uploads/2011/12/Publishing-Feature-Navigation.png"><img class="alignnone size-medium wp-image-2225" title="Publishing Feature Navigation" src="http://www.novolocus.com/wp-content/uploads/2011/12/Publishing-Feature-Navigation-300x185.png" alt="" width="300" height="185" /></a></p>
<p>And allows all sorts of things, like showing links to particular Audiences, showing subsites, etc.. It&#8217;s pretty useful.</p>
<p>Unfortunately, the Publishing Infrastructure does a <em>lot</em> more than change the navigation. It will create libraries for styles, and add columns, content types, page layouts, XSL files, and all sorts of stuff. That&#8217;s quite a lot of extra weight and complexity just for the navigation.</p>
<p>However, when you turn on the Publishing Infrastructure feature it actually turns on a number of hidden features. Could there be one that just deals with the navigation?</p>
<p>Well, it turns out that yes, there is. It&#8217;s called the &#8220;Navigation&#8221; feature in the FEATURES folder. Looking inside it, you can see that all it does is add and hide some custom actions (related to the link to the Publishing Navigation Administration page), and use some delegate controls to replace the navigation data sources.</p>
<p><a href="http://www.novolocus.com/wp-content/uploads/2011/12/Navigation-Feature-XML.png"><img class="alignnone size-medium wp-image-2223" title="Navigation Feature XML" src="http://www.novolocus.com/wp-content/uploads/2011/12/Navigation-Feature-XML-300x213.png" alt="" width="300" height="213" /></a></p>
<p>So, can we activate just this feature? Not through the user interface &#8211; it&#8217;s hidden. But through STSADM or powershell, then yes. The Feature&#8217;s name is <code>Navigation</code>, and it&#8217;s GUID is: <code>89E0306D-453B-4ec5-8D68-42067CDBF98E</code></p>
<p><code>stsadm -o activatefeature -name navigation -url &lt;url to site&gt;</code></p>
<p>I&#8217;ve not tested it extensively, but this seems to work okay from the bit of testing I have done. I couldn&#8217;t help but notice that the &#8216;Pages&#8217; checkboxes on some of the settings were also greyed out:</p>
<p><a href="http://www.novolocus.com/wp-content/uploads/2011/12/Pages-Checkbox-greyed-out.png"><img class="alignnone size-full wp-image-2226" title="Pages Checkbox greyed out" src="http://www.novolocus.com/wp-content/uploads/2011/12/Pages-Checkbox-greyed-out.png" alt="" width="284" height="119" /></a></p>
<p>To me, this suggests that someone actually designed this navigation to work without the rest of the Publishing Infrastructure, so hopefully, it should be okay by itself.</p>
<img src="http://feeds.feedburner.com/~r/novolocus/~4/pAFv1W99TZY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2011/12/02/publishing-navigation-without-the-publishing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.novolocus.com/2011/12/02/publishing-navigation-without-the-publishing/</feedburner:origLink></item>
		<item>
		<title>Editing a XAML build process</title>
		<link>http://feedproxy.google.com/~r/novolocus/~3/qlBXHgGGb80/</link>
		<comments>http://www.novolocus.com/2011/12/01/editing-a-xaml-build-process/#comments</comments>
		<pubDate>Thu, 01 Dec 2011 15:00:41 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[MSBuild]]></category>
		<category><![CDATA[TFS]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=2205</guid>
		<description><![CDATA[So, we&#8217;ve been working on putting our SharePoint solutions through a proper build process in Team Foundation Server 2010 (TFS), and I hit a bit of a snag. I had been given a build definition that had a build process &#8230; <a href="http://www.novolocus.com/2011/12/01/editing-a-xaml-build-process/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>So, we&#8217;ve been working on putting our SharePoint solutions through a proper build process in Team Foundation Server 2010 (TFS), and I hit a bit of a snag.</p>
<p>I had been given a build definition that had a build process &#8211; a Workflow Foundation workflow &#8211; that I wanted to alter. The problem was that while I had the XAML file for that workflow, and the DLL that defined some custom code activities that the process used, I didn&#8217;t have a full Visual Studio project for it. No problem, I thought, I&#8217;ll just open the XAML up in Visual Studio and edit it.</p>
<p>Wrong.</p>
<p><a href="http://www.novolocus.com/wp-content/uploads/2011/11/Problems-with-editing-XAML.png"><img class="alignnone size-medium wp-image-2214" title="Problems with editing XAML" src="http://www.novolocus.com/wp-content/uploads/2011/11/Problems-with-editing-XAML-300x231.png" alt="" width="300" height="231" /></a></p>
<p><span id="more-2205"></span></p>
<p>While I could open the XAML file, it was not displayed such that I could edit it, and the custom code activities showed up as errors. What I really needed to be able to do was make this a proper Visual Studio project to edit. But how? Well&#8230;</p>
<ul>
<li>Create a new Visual Studio Project. Use the Workflow &gt; Activity Library template.</li>
<li>Remove the XAML file that is automatically added to the new project. You can delete it.</li>
<li>Add your existing XAML file.</li>
<li>Add references to any additional assemblies that your project uses.</li>
</ul>
<p>Presto &#8211; I could now edit my workflow within Visual Studio. I checked this into TFS (to sit alongside the code for my project) and changed my build definition to use my newly edited process.</p>
<img src="http://feeds.feedburner.com/~r/novolocus/~4/qlBXHgGGb80" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2011/12/01/editing-a-xaml-build-process/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.novolocus.com/2011/12/01/editing-a-xaml-build-process/</feedburner:origLink></item>
		<item>
		<title>Error: ‘b’ is null or not an object</title>
		<link>http://feedproxy.google.com/~r/novolocus/~3/oD3MEqZ1028/</link>
		<comments>http://www.novolocus.com/2011/11/29/error-b-is-null-or-not-an-object/#comments</comments>
		<pubDate>Tue, 29 Nov 2011 12:57:21 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Development 2010]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[clientobjectmodel]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=2207</guid>
		<description><![CDATA[This error has caused me so much pain when trying to use SharePoint&#8217;s JavaScript client-side object model (CSOM), so, in case I have it again: Check that the function exists. Check that the function is named correctly. Make sure that &#8230; <a href="http://www.novolocus.com/2011/11/29/error-b-is-null-or-not-an-object/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This error has caused me so much pain when trying to use SharePoint&#8217;s JavaScript client-side object model (CSOM), so, in case I have it again:</p>
<ol>
<li>Check that the function exists.</li>
<li>Check that the function is named correctly.</li>
<li>Make sure that you&#8217;re not using &#8220;this&#8221; in the call to <strong>createDelegate</strong>, <a href="http://www.dev4side.com/community/blog/2010/12/11/error-'b'-is-null-or-nota-n-object-using-ecma-script-client-sharepoint-2010-object-model.aspx">as detailed here</a>.
<ul>
<li>Right: <code>Function.createDelegate(this, onSuccessMethod)</code></li>
<li>Wrong: <code>Function.createDelegate(this, this.onSuccessMethod)</code></li>
</ul>
<p>I don&#8217;t know why this difference should cause this error, but I&#8217;ve proved it true.</li>
</ol>
<p>If you know of other causes of this error, let me know, I&#8217;ll add it to the list. I love the experience of debugging JavaScript&#8230;</p>
<img src="http://feeds.feedburner.com/~r/novolocus/~4/oD3MEqZ1028" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2011/11/29/error-b-is-null-or-not-an-object/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.novolocus.com/2011/11/29/error-b-is-null-or-not-an-object/</feedburner:origLink></item>
		<item>
		<title>New Web Application returns HTTP 503</title>
		<link>http://feedproxy.google.com/~r/novolocus/~3/alxRk6g0nrg/</link>
		<comments>http://www.novolocus.com/2011/10/17/new-web-application-returns-http-503/#comments</comments>
		<pubDate>Mon, 17 Oct 2011 09:49:29 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Admin 2010]]></category>
		<category><![CDATA[IIS]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=2200</guid>
		<description><![CDATA[For some reason a new web application on my development VM always returns a 503 Service Unavailable when you go to it. It turns out that this is due to the app pool supporting 32 bit applications! Change the setting &#8230; <a href="http://www.novolocus.com/2011/10/17/new-web-application-returns-http-503/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>For some reason a new web application on my development VM always returns a 503 Service Unavailable when you go to it.</p>
<p><a href="http://www.novolocus.com/wp-content/uploads/2011/10/Service-Unavailable.png"><img class="alignnone size-medium wp-image-2201" title="Service Unavailable" src="http://www.novolocus.com/wp-content/uploads/2011/10/Service-Unavailable-300x123.png" alt="" width="300" height="123" /></a></p>
<p>It turns out that this is due to the app pool supporting 32 bit applications! Change the setting in IIS (App Pool &gt; Advanced Settings &gt; Enable 32 Bit applications should be false)</p>
<p><a href="http://www.novolocus.com/wp-content/uploads/2011/10/Setting-to-fix.png"><img class="alignnone size-medium wp-image-2202" title="Setting to fix" src="http://www.novolocus.com/wp-content/uploads/2011/10/Setting-to-fix-300x153.png" alt="" width="300" height="153" /></a></p>
<img src="http://feeds.feedburner.com/~r/novolocus/~4/alxRk6g0nrg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2011/10/17/new-web-application-returns-http-503/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.novolocus.com/2011/10/17/new-web-application-returns-http-503/</feedburner:origLink></item>
		<item>
		<title>Allowing logging for a particular app pool</title>
		<link>http://feedproxy.google.com/~r/novolocus/~3/HZLZJqctWM8/</link>
		<comments>http://www.novolocus.com/2011/10/14/allowing-logging-for-a-particular-app-pool/#comments</comments>
		<pubDate>Fri, 14 Oct 2011 09:49:15 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Admin 2010]]></category>
		<category><![CDATA[Logging]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=2198</guid>
		<description><![CDATA[I had a problem that one of our development machines had been configured in a &#8216;Least Privileges&#8217; configuration &#8211; and it was a bit too least. The content app pool could not write to the logs. OWSTimer and WebAnalytics both &#8230; <a href="http://www.novolocus.com/2011/10/14/allowing-logging-for-a-particular-app-pool/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I had a problem that one of our development machines had been configured in a &#8216;Least Privileges&#8217; configuration &#8211; and it was a bit too least. The content app pool could not write to the logs. OWSTimer and WebAnalytics both could, but there was nothing from W3WP for that web app.</p>
<p>Just a reminder to myself&#8230;</p>
<p>Well, the solution was to add the app pool account to the &#8216;Performance Log Users&#8217; group in AD. You find it under BUILTIN. Reset ISS. Voila!</p>
<img src="http://feeds.feedburner.com/~r/novolocus/~4/HZLZJqctWM8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2011/10/14/allowing-logging-for-a-particular-app-pool/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.novolocus.com/2011/10/14/allowing-logging-for-a-particular-app-pool/</feedburner:origLink></item>
		<item>
		<title>Setting a Timer Job’s Description</title>
		<link>http://feedproxy.google.com/~r/novolocus/~3/YuPq_2xKCL0/</link>
		<comments>http://www.novolocus.com/2011/09/15/setting-a-timer-jobs-description/#comments</comments>
		<pubDate>Thu, 15 Sep 2011 11:56:17 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Development 2010]]></category>
		<category><![CDATA[SPJobDefinition]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=2187</guid>
		<description><![CDATA[A curious problem &#8211; Timer Jobs have a Title (which you can set), and a description, which you can&#8217;t set &#8211; as it has no setter: This is a shame, as I like that you can see a description about the &#8230; <a href="http://www.novolocus.com/2011/09/15/setting-a-timer-jobs-description/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>A curious problem &#8211; Timer Jobs have a Title (which you can set), and a description, which you can&#8217;t set &#8211; as it has no setter:</p>
<p><a href="http://www.novolocus.com/wp-content/uploads/2011/09/TimerJobCode-in-Visual-Studio.png"><img class="alignnone size-medium wp-image-2188" title="TimerJobCode in Visual Studio" src="http://www.novolocus.com/wp-content/uploads/2011/09/TimerJobCode-in-Visual-Studio-300x83.png" alt="" width="300" height="83" /></a></p>
<p>This is a shame, as I like that you can see a description about the time job in Central Admin:</p>
<p><a href="http://www.novolocus.com/wp-content/uploads/2011/09/Timer-Job-in-Central-Admin.png"><img class="alignnone size-medium wp-image-2189" title="Timer Job in Central Admin" src="http://www.novolocus.com/wp-content/uploads/2011/09/Timer-Job-in-Central-Admin-300x143.png" alt="" width="300" height="143" /></a></p>
<p>The solution &#8211; strange as it seems, override the Description property in your new timer job.</p>
<p><a href="http://www.novolocus.com/wp-content/uploads/2011/09/override.png"><img class="alignnone size-medium wp-image-2190" title="override" src="http://www.novolocus.com/wp-content/uploads/2011/09/override-300x80.png" alt="" width="300" height="80" /></a></p>
<img src="http://feeds.feedburner.com/~r/novolocus/~4/YuPq_2xKCL0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2011/09/15/setting-a-timer-jobs-description/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.novolocus.com/2011/09/15/setting-a-timer-jobs-description/</feedburner:origLink></item>
		<item>
		<title>Annoying Navigation in Search Centers</title>
		<link>http://feedproxy.google.com/~r/novolocus/~3/_sC61EEwwMM/</link>
		<comments>http://www.novolocus.com/2011/09/12/annoying-navigation-in-search-centers/#comments</comments>
		<pubDate>Mon, 12 Sep 2011 14:00:02 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Search 2010]]></category>
		<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[Search]]></category>
		<category><![CDATA[Site Definition]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=1966</guid>
		<description><![CDATA[I had two of my colleagues come to me with the same complaint &#8211; that the Basic Search Center site template in SharePoint 2010 doesn&#8217;t have any navigation to get &#8216;back&#8217; to the rest of the site collection: I pointed &#8230; <a href="http://www.novolocus.com/2011/09/12/annoying-navigation-in-search-centers/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I had two of my colleagues come to me with the same complaint &#8211; that the Basic Search Center site template in SharePoint 2010 doesn&#8217;t have any navigation to get &#8216;back&#8217; to the rest of the site collection:</p>
<p><a href="http://www.novolocus.com/wp-content/uploads/2010/12/The-Basic-Search-Center-Minimal-Master-Page.png"><img class="alignnone size-medium wp-image-1967" title="The Basic Search Center (Minimal Master Page)" src="http://www.novolocus.com/wp-content/uploads/2010/12/The-Basic-Search-Center-Minimal-Master-Page-300x189.png" alt="" width="300" height="189" /></a></p>
<p>I pointed out to them that there are good reasons to consider having the Search Center separated from the rest of your content. I&#8217;d even suggest a separate Site Collection (or even Web App) if using the Enterprise Search Center (which uses the publishing features, and you might not want them turned on in your existing site collection). However, in their instances they didn&#8217;t really need all that, and really did just want a simple search center in the Site Collection. For example, a departmental site collection might want its own search center and search experience.</p>
<p>So, I set forth to fix this dire state of affairs for them.<span id="more-1966"></span>Looking at the above page I noted that the page seemed to be using a different master page, and that the horizontal scroll bar was shown &#8211; why is unclear, but it doesn&#8217;t look good. Looking into the master page side of things in SharePoint Designer, I found that the master page being used was &#8216;Minimal.master&#8217;. I decided to change this to &#8216;V4.master&#8217;, and this is what I got:</p>
<p><a href="http://www.novolocus.com/wp-content/uploads/2010/12/The-Basic-Search-Center-V4-Master-Page.png"><img class="alignnone size-medium wp-image-1968" title="The Basic Search Center (V4 Master Page)" src="http://www.novolocus.com/wp-content/uploads/2010/12/The-Basic-Search-Center-V4-Master-Page-300x194.png" alt="" width="300" height="194" /></a></p>
<p>Excellent, we&#8217;ve got our navigation controls back, and the horizontal scroll has gone. Sadly, so has our search box. I knew that from SharePoint 2007 that the idiot who had designed this page had put the search box into the PlaceHolderTitleBreadcrumb placeholder on the master page (what was wrong with the main content area?). So, I assumed that the same was happening here, which turned out to be true:</p>
<p><a href="http://www.novolocus.com/wp-content/uploads/2010/12/Location-of-the-Search-Box-Web-Part.png"><img class="alignnone size-medium wp-image-1969" title="Location of the Search Box Web Part" src="http://www.novolocus.com/wp-content/uploads/2010/12/Location-of-the-Search-Box-Web-Part-300x209.png" alt="" width="300" height="209" /></a></p>
<p>So, I started changing the page by putting the search box into the main content area of the page. I also added CSS to all the pages (default, results and advance search) to hide the left navigation. Next, each of these pages was adding it&#8217;s own ribbon and site actions controls to the top of the page, so I removed these too. And so I had the following as pages:</p>
<p><a href="http://www.novolocus.com/wp-content/uploads/2010/12/Basic-Search-Center-with-Navigation.png"><img class="alignnone size-medium wp-image-1970" title="Basic Search Center with Navigation" src="http://www.novolocus.com/wp-content/uploads/2010/12/Basic-Search-Center-with-Navigation-300x229.png" alt="" width="300" height="229" /></a></p>
<p>Note the top navigation tabs, and the &#8220;up a level&#8221; control with breadcrumbs. And here is the results page:</p>
<p><a href="http://www.novolocus.com/wp-content/uploads/2010/12/Basic-Search-Center-with-Navigation-Results-Page.png"><img class="alignnone size-medium wp-image-1971" title="Basic Search Center with Navigation - Results Page" src="http://www.novolocus.com/wp-content/uploads/2010/12/Basic-Search-Center-with-Navigation-Results-Page-300x130.png" alt="" width="300" height="130" /></a></p>
<p><a href="http://www.deltascheme.com/deltascheme-products/basic-search-center-with-navigation-for-sharepoint/">You can download the site template for this (for free!) and use it yourself</a>.</p>
<p><strong>EDIT: I gather that it isn&#8217;t actually available for download yet. Apparently Sales want to release it and a number of other items simultaneously. It should be available in a week or so.</strong></p>
<p>Alternatively, <a href="http://youtu.be/Qo_1ljp7n2c">I did a video about it</a>, too.</p>
<p>To install:</p>
<ul>
<li>Upload the solution to the solution gallery of your site</li>
<li>Activate the solution</li>
<li>Create a site using it.</li>
<li>Go into the Site Settings &gt; Top link bar and click “Use links from Parent”</li>
<li>On both the Search Page and Search Results pages, edit the page and modify the Search Box web parts. In the Miscellanous section, fill in the correct Advanced Search Page URL</li>
<li>On the Advanced Search Page, edit the page and modify the Advanced Search Web Part. In the Miscellaneous section, fill in the correct Results URL</li>
</ul>
<p>(Sorry about the last steps – for some reason this is determined to create the site breaking inheritance of navigation, and it’s too much effort to try to figure out why. And changing the URLs in those web parts seemed like too much effort, too. You&#8217;re not going to be creating hundreds of these, right?)</p>
<img src="http://feeds.feedburner.com/~r/novolocus/~4/_sC61EEwwMM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2011/09/12/annoying-navigation-in-search-centers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.novolocus.com/2011/09/12/annoying-navigation-in-search-centers/</feedburner:origLink></item>
		<item>
		<title>Further notes on SmartAssembly Obfuscation</title>
		<link>http://feedproxy.google.com/~r/novolocus/~3/0x6OHn5ox5s/</link>
		<comments>http://www.novolocus.com/2011/09/09/further-notes-on-smartassembly-obfuscation/#comments</comments>
		<pubDate>Fri, 09 Sep 2011 12:14:27 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Obfuscation]]></category>
		<category><![CDATA[SmartAssembly]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=2177</guid>
		<description><![CDATA[Some further notes on things I&#8217;ve learnt using SmartAssembly on some of our products. Constants do not get obfuscated. Use static readonly variables in their place if the constant contains sensitive information. Run Reflector (or reflection tool of your choice) against &#8230; <a href="http://www.novolocus.com/2011/09/09/further-notes-on-smartassembly-obfuscation/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Some further notes on things I&#8217;ve learnt using SmartAssembly on some of our products.</p>
<ul>
<li>Constants do not get obfuscated. Use static readonly variables in their place if the constant contains sensitive information.</li>
<li>Run Reflector (or reflection tool of your choice) against your assembly after obfuscation, to check what is visible. Then go back and make the bits you accidentally left <em>public</em> <em>internal</em> or <em>private. </em></li>
<li><strong>Make as many classes and methods as you can Internal</strong></li>
<li>Do read the instructions on the <a href="http://www.red-gate.com/supportcenter/Content?p=SmartAssembly&amp;c=SmartAssembly/help/6.0/SA_UsingCustomAttributes.htm&amp;toc=SmartAssembly/help/6.0/toc.htm">attributes you can apply</a> to control obfuscation.</li>
<li>Do use Pruning if you want to remove parameter names for methods. That can leak a lot of information about what a class is doing.</li>
</ul>
<p>&nbsp;</p>
<p>&nbsp;</p>
<img src="http://feeds.feedburner.com/~r/novolocus/~4/0x6OHn5ox5s" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2011/09/09/further-notes-on-smartassembly-obfuscation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.novolocus.com/2011/09/09/further-notes-on-smartassembly-obfuscation/</feedburner:origLink></item>
		<item>
		<title>Obfuscation, Code Analysis, and Check-In policies</title>
		<link>http://feedproxy.google.com/~r/novolocus/~3/3Xaj91WNgbo/</link>
		<comments>http://www.novolocus.com/2011/09/07/obfuscation-code-analysis-and-check-in-policies/#comments</comments>
		<pubDate>Wed, 07 Sep 2011 13:04:25 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Code Analysis]]></category>
		<category><![CDATA[Obfuscation]]></category>
		<category><![CDATA[TFS]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=2168</guid>
		<description><![CDATA[As mentioned before, we&#8217;ve started to use SmartAssembly to obfuscate some of our products. We also use Team Foundation Server (TFS) as source control and build server. Using obfuscation with code analysis caused some issues, which were compounded by our &#8230; <a href="http://www.novolocus.com/2011/09/07/obfuscation-code-analysis-and-check-in-policies/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>As <a href="http://www.novolocus.com/2011/09/05/adding-smartassembly-obfuscation-to-a-visual-studio-project/">mentioned before</a>, we&#8217;ve started to use SmartAssembly to obfuscate some of our products. We also use Team Foundation Server (TFS) as source control and build server. Using obfuscation with code analysis caused some issues, which were compounded by our check-in policies.<span id="more-2168"></span></p>
<p>Obfuscation prevents analysis of code using reflection. Code analysis uses reflection to analyse code. There is, therefore, a bit of a problem if you try to use both during your build process, either within Visual Studio, or on a build server. Code analysis would often crash:</p>
<p><a href="http://www.novolocus.com/wp-content/uploads/2011/09/Code-Analysis-Exception.png"><img class="alignnone size-medium wp-image-2170" title="Code Analysis Exception" src="http://www.novolocus.com/wp-content/uploads/2011/09/Code-Analysis-Exception-300x76.png" alt="" width="300" height="76" /></a></p>
<p>&#8230; and if you looked in the Code Analysis logs, you&#8217;d see it was FXCop failing:</p>
<p><a href="http://www.novolocus.com/wp-content/uploads/2011/09/FXCop-Exception.png"><img class="alignnone size-medium wp-image-2169" title="FXCop Exception" src="http://www.novolocus.com/wp-content/uploads/2011/09/FXCop-Exception-300x110.png" alt="" width="300" height="110" /></a></p>
<p>Typically, the errors are things like “Index was outside the bounds of the array”.</p>
<p>Therefore, if you have a check-in policy that demands that code analysis has been run, you can&#8217;t run obfuscation within your Visual Studio builds. There is a risk that the obfuscated assembly will cause Code Analysis to crash, and if Code Analysis doesn&#8217;t complete, you won&#8217;t be able to check-in your code. The example code in <a href="http://www.novolocus.com/2011/09/05/adding-smartassembly-obfuscation-to-a-visual-studio-project/">my previous post </a>shows how to set up a condition so that you don’t obfuscate locally built assembly. That way, you can at least check your code in, and during development I&#8217;m not too concerned about the assembly being obfuscated. In fact, I&#8217;d rather it wasn&#8217;t, so that I could debug it more easily.</p>
<p>However, you’ve still got the problem of builds on the build server trying to run code analysis on an obfuscated assembly. They will still generate the same error, and you really do have to obfuscate at the point. There are two solutions that I found:</p>
<ol>
<li>Turn off code analysis within the build process. Edit your build definition, go to the Process tab, and set Code Analysis to &#8220;Never&#8221;<br />
<a href="http://www.novolocus.com/wp-content/uploads/2011/09/Turn-off-code-analysis.png"><img class="alignnone size-medium wp-image-2171" title="Turn off code analysis" src="http://www.novolocus.com/wp-content/uploads/2011/09/Turn-off-code-analysis-300x146.png" alt="" width="300" height="146" /></a><br />
You will not then see code analysis warnings/errors within TFS. However, <span style="text-decoration: underline;">developers will still have to run code analysis before check-in</span>, so they should still see any warnings/errors at that time.</li>
<li>Modify the .csproj file. You could duplicate the ProjectGroup for Release in the .csproj file, add conditions to them so one runs inside Visual Studio and the other outside (i.e. on build server), and finally set the Code Analysis to <em>not</em> run on the build server:<br />
<a href="http://www.novolocus.com/wp-content/uploads/2011/09/property-groups-after-modification.png"><img class="alignnone size-medium wp-image-2172" title="property groups after modification" src="http://www.novolocus.com/wp-content/uploads/2011/09/property-groups-after-modification-300x120.png" alt="" width="300" height="120" /></a><br />
This works &#8211; I tried it &#8211; but I don&#8217;t like modifying the .csproj file if I can avoid it.</li>
</ol>
<p>That second option feels a bit complicated to me, so I prefer the first option. To us, I think it&#8217;s more important to know that the Code Analysis warnings were presented to the developer than particularly worrying about them being captured in TFS too.</p>
<img src="http://feeds.feedburner.com/~r/novolocus/~4/3Xaj91WNgbo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2011/09/07/obfuscation-code-analysis-and-check-in-policies/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.novolocus.com/2011/09/07/obfuscation-code-analysis-and-check-in-policies/</feedburner:origLink></item>
		<item>
		<title>Adding SmartAssembly obfuscation to a Visual Studio Project</title>
		<link>http://feedproxy.google.com/~r/novolocus/~3/oizK2DhnsjI/</link>
		<comments>http://www.novolocus.com/2011/09/05/adding-smartassembly-obfuscation-to-a-visual-studio-project/#comments</comments>
		<pubDate>Mon, 05 Sep 2011 12:55:07 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[MSBuild]]></category>
		<category><![CDATA[Obfuscation]]></category>
		<category><![CDATA[SmartAssembly]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=2163</guid>
		<description><![CDATA[We&#8217;ve started to use SmartAssembly to obfuscate the code for some of the SharePoint products that we&#8217;ve been working on, and I&#8217;d had a few problems with it. SmartAssembly&#8217;s manual describes how to include the SmartAssembly project file (.saproj) into &#8230; <a href="http://www.novolocus.com/2011/09/05/adding-smartassembly-obfuscation-to-a-visual-studio-project/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve started to use SmartAssembly to obfuscate the code for some of the SharePoint products that we&#8217;ve been working on, and I&#8217;d had a few problems with it.<span id="more-2163"></span></p>
<p>SmartAssembly&#8217;s manual describes<a href="http://www.red-gate.com/supportcenter/Content?p=SmartAssembly&amp;c=SmartAssembly/help/5.0/SA_UsingSmartAssemblyWithMSBuild.htm&amp;toc=SmartAssembly/help/5.0/toc1032253.htm"> how to include the SmartAssembly project file </a>(.saproj) into your build process. This is basically simple:</p>
<ol>
<li>Add the .saproj file to your Visual Studio Project</li>
<li> Right click on your project within Solution Explorer and select ‘Unload Project’</li>
<li>Right click on your project within Solution Explorer and select ‘Edit projectname.csproj’</li>
<li> Scroll down to the bottom of the file – we now need to add some additional lines to the file to tigger obfuscation during the build process.<br />
Add the following lines to the bottom of the file, just before &lt;/Project&gt;.  You will need to modify the .saproj filename accordingly:</li>
</ol>
<pre class="brush: xml; title: ; notranslate">&lt;UsingTask TaskName=&quot;SmartAssembly.MSBuild.Tasks.Build&quot; AssemblyName=&quot;SmartAssembly.MSBuild.Tasks, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7f465a1c156d4d57&quot; /&gt;
 &lt;Target Name=&quot;AfterCompile&quot; Condition=&quot;'$(Configuration)' == 'Release'&quot;&gt;
 &lt;SmartAssembly.MSBuild.Tasks.Build ProjectFile=&quot;$(ProjectDir)HelloWorld.saproj&quot; OverwriteAssembly=&quot;True&quot; /&gt;
 &lt;/Target&gt;</pre>
<p>This is what worked for my colleagues &#8211; but not for my projects. I kept receiving an error:</p>
<blockquote><p>SmartAssembly build failed: The system cannot find the file specified (Exception from HRESULT: 0&#215;80070002)</p></blockquote>
<p>There wasn&#8217;t much clue what that meant. Looking on the Redgate forums, it seems like <a href="http://www.red-gate.com/messageboard/viewtopic.php?t=11792&amp;postdays=0&amp;postorder=asc&amp;start=0">I wasn&#8217;t the first person with this issue</a>. The suggestion seemed to be to run from the command line, rather than using Redgate&#8217;s MSBuild task. That seems a shame, but I tried it:</p>
<pre class="brush: xml; title: ; notranslate">&lt;Target Name=&quot;AfterCompile&quot; Condition=&quot;'$(Configuration)' == 'Release' AND '$(BuildingInsideVisualStudio)' != 'true'&quot;&gt;
&lt;Exec Command=&quot;&amp;quot;C:\Program Files\Red Gate\SmartAssembly 6\SmartAssembly.com&amp;quot; &amp;quot;$(ProjectDir)HelloWorld.saproj&amp;quot; /output=$self&quot; /&gt;
&lt;/Target&gt;</pre>
<p>This seemed to work nicely. I know that the command has a fixed path in it, but this command should only be run on the build server (hence the bit about <em>$(BuildingInsideVisualStudio)</em> ). More on why I did that in my next post.</p>
<img src="http://feeds.feedburner.com/~r/novolocus/~4/oizK2DhnsjI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2011/09/05/adding-smartassembly-obfuscation-to-a-visual-studio-project/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.novolocus.com/2011/09/05/adding-smartassembly-obfuscation-to-a-visual-studio-project/</feedburner:origLink></item>
		<item>
		<title>WSPBuilder 2010 and TFS2010</title>
		<link>http://feedproxy.google.com/~r/novolocus/~3/9KHfWlgMRb4/</link>
		<comments>http://www.novolocus.com/2011/08/19/wspbuilder-2010-and-tfs2010/#comments</comments>
		<pubDate>Fri, 19 Aug 2011 12:36:20 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Development 2010]]></category>
		<category><![CDATA[TFS]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[WSPBuilder]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=2154</guid>
		<description><![CDATA[With SharePoint 2007, WSPBuilder became our standard packaging tool for SharePoint solutions. It was simple, powerful, and a damn site easier than trying to write your own manifest. Well, SharePoint 2010 and Visual Studio 2010 followed later, and Microsoft introduced &#8230; <a href="http://www.novolocus.com/2011/08/19/wspbuilder-2010-and-tfs2010/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>With SharePoint 2007, <a href="http://wspbuilder.codeplex.com/releases/view/30858">WSPBuilder </a>became our standard packaging tool for SharePoint solutions. It was simple, powerful, and a damn site easier than trying to write your own manifest.</p>
<p>Well, SharePoint 2010 and Visual Studio 2010 followed later, and Microsoft introduced much better tooling of their own. However, we&#8217;ve still got a lot of code being packaged by WSPBuilder, and we didn&#8217;t want to have to refactor all those projects just to package them for 2010.</p>
<p>Fortunately, Carsten Keutmann wrote a 2010 version (still in &#8216;BETA&#8217;, but it works fine). It offers many of the same extensions to Visual Studio as the previous version did.</p>
<p>However, I recently had to automate (in Team Foundation Server 2010) the build of one of our WSPBuilder based solutions, and that&#8217;s where things got more interesting&#8230;<span id="more-2154"></span></p>
<p>First off, let&#8217;s be clear, there are a couple of different issues here:</p>
<ul>
<li>What are the differences between a 2007 and a 2010 solution package?</li>
<li>Can we integrate WSPBuilder into our build process in TFS?</li>
</ul>
<p>I started by looking at the first question. I knew that my project &#8211; a little web part to display search results from Twitter &#8211; should work in 2010 without modification. So, on a SP2007 server, I packaged it using the WSPBuilder for 2007. I then installed the WSPBuilder Extensions for 2010 &#8211; <a href="http://keutmann.blogspot.com/2010/04/wspbuilder-systems-compatibility.html">these should still work for SP2007/VS2008</a> &#8211; and repackaged it. I compared the WSPs &#8211; and found that the manifests were different.</p>
<p><a href="http://www.novolocus.com/wp-content/uploads/2011/08/Capture.png"><img class="alignnone size-medium wp-image-2155" title="Comparison of Manifest Files" src="http://www.novolocus.com/wp-content/uploads/2011/08/Capture-300x73.png" alt="" width="300" height="73" /></a></p>
<p>Ok, no problems there &#8211; a few bits in a different order, and the manifest shows compatibility to be 2007 and 2010. That&#8217;s cool.</p>
<p>Then on a SP2010 server, I took the same code and packaged it, and I then compared the two WSPs. There were different. The manifests were different:</p>
<p><a href="http://www.novolocus.com/wp-content/uploads/2011/08/Capture1.png"><img class="alignnone size-medium wp-image-2156" title="Comparisions of Manifest from SP2007 and SP2010 Servers" src="http://www.novolocus.com/wp-content/uploads/2011/08/Capture1-300x34.png" alt="Comparisions of Manifest from SP2007 and SP2010 Servers" width="300" height="34" /></a></p>
<p>Okay &#8211; so the solution tag is different (it has an extra attribute), and the line showing compatibility now shows SharePoint 2010 only as being compatible. I hadn&#8217;t changed my code at all, so the difference must be down to the server that it&#8217;s running on. I&#8217;d a hunch that if WSPBuilder was being run on a SP2010 server it would default to packaging for SharePoint 2010 only. However, WSPBuilder is pretty well thought out in the options you can feed in, so I figured that there must be an argument that I could feed in to tell it to package for 2007 or 2010 when being run on SharePoint 2010 server.</p>
<p>I was wrong. Eventually, I came across a series about &#8220;<a href="http://blog.muhimbi.com/2010/03/porting-sharepoint-2007-wspbuilder_12.html">Porting a SharePoint 2007 WSPBuilder solution to SharePoint 2010</a>&#8221; by Muhimbi where they said:</p>
<blockquote><p>Note that if you want to use WSPBuilder to build a hybrid SharePoint 2007 / 2010 solution or a solution that just targets SharePoint 2007 then you must perform the build on a machine that runs SharePoint 2007. The latest version of WSPBuilder checks which version of SharePoint is installed on the build machine and adds SharePoint 2010 specific elements to the generated WSP file, causing deployments to fail in SharePoint 2007 environments.</p></blockquote>
<p>Well, that&#8217;s what I was seeing. Just in case I checked the source on Codeplex. In the <strong>Keutmann.SharePoint.WSPBuilder.Library.ManifestConfig</strong> class, the choice between a SP2007 or SP2010 manifest seems to come from the registry &#8211; specifically, from checking the subkeys of SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\ . A &#8220;12&#8243; means SP2007, and a &#8220;14&#8243; means SP2010. There doesn&#8217;t seem to be an argument to pass in, and this means that if your build server has SP2010 installed on it &#8211; even if it isn&#8217;t configured &#8211; then all WSPs built on it will only be SP2010 compatible. Yuck.</p>
<p>It then occurred to me, could I install both the 2007 and 2010 versions of WSPBuilder? In short, no, the installer wouldn&#8217;t let me.</p>
<p>Okay, so, another thought &#8211; what if you don&#8217;t have SharePoint on the build server at all? Well, you&#8217;d have to put any assemblies you want to reference (like <em>Microsoft.SharePoint.dll</em>) into your TFS project, and reference them rather than the ones in 12 or 14 hive, but that&#8217;s not a problem. However, what would WSPBuilder do? Well, a quick test shows that it might well build it for SP2007 &#8211; and so be compatible with 2010 &#8211; but I&#8217;ve not really looked into it that far. It could be worth investigation; I gave up as I was unlikely to be allowed to remove SharePoint 2010 from our build server. For now, if I want automated builds to work for SharePoint 2007, we&#8217;ll need a second build server.</p>
<p>Phew! All of which led me around to the second question &#8211; how to integrate the packaging with the build server. I found some <a href="http://blog.brianfarnhill.com/2009/06/use-tfs-to-automate-even-better-wsp-builds-with-wspbuilder/">good posts about this by Brian Farnhill</a>, but they were for Team Foundation Server 2008. His approach was to use a post-build event to run a little script, and in that script he a) copies the DLL to the correct location, and b) runs WSPBuilder. &#8220;Excellent&#8221;, I thought. It didn&#8217;t work.</p>
<p>It seems that the problem lies in the script itself; <em>$(IsDesktopBuild)</em> wasn&#8217;t returned what one would expect for Visual Studio 2010. So, instead, I came up with the following script:</p>
<p><code>if '$(BuildingInsideVisualStudio)' == 'true' GOTO LocalBuild<br />
:TfsBuild<br />
MD "$(ProjectDir)bin\$(ConfigurationName)"<br />
COPY "$(TargetDir)*.dll" "$(ProjectDir)bin\$(ConfigurationName)"<br />
CD $(ProjectDir)<br />
"C:\Program Files (x86)\WSPTools\WSPBuilderExtensions\WSPBuilder.exe"<br />
MD "$(TargetDir)WSPs"<br />
MOVE "$(ProjectDir)\*.wsp" "$(TargetDir)\WSPs"<br />
GOTO Finish<br />
:LocalBuild<br />
"C:\Program Files (x86)\WSPTools\WSPBuilderExtensions\WSPBuilder.exe" -DeploymentTarget GAC<br />
:Finish</code></p>
<p>Excellent. <em>$(BuildingInsideVisualStudio)</em> does behave properly. I did find one quirk with this now, though &#8211; my solution was being packaged on a local build as if the assembly was being deployed to the BIN. Sadly, I needed it in the GAC (and this is how TFS was packaging it), and hence the argument to set the DeploymentTarget that you can see above.</p>
<p><strong>Conclusions</strong></p>
<p>Well, I now had my build working. However, the packaged solution was only compatible with SharePoint 2010. As it turned out, this was acceptable (there were other changes that we had to make for SP2010). If we wanted to package the 2007 version for 2007 deployment, though, we would need another build server as there doesn&#8217;t seem to be a way of telling WSPBuilder to ignore the fact that it&#8217;s on a SharePoint 2010 server.</p>
<img src="http://feeds.feedburner.com/~r/novolocus/~4/9KHfWlgMRb4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2011/08/19/wspbuilder-2010-and-tfs2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.novolocus.com/2011/08/19/wspbuilder-2010-and-tfs2010/</feedburner:origLink></item>
		<item>
		<title>My Logging Diagnostics Service for SharePoint 2010</title>
		<link>http://feedproxy.google.com/~r/novolocus/~3/pEbXLNrqbX0/</link>
		<comments>http://www.novolocus.com/2011/06/27/my-logging-diagnostics-service-for-sharepoint-2010/#comments</comments>
		<pubDate>Mon, 27 Jun 2011 12:00:03 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Development 2010]]></category>
		<category><![CDATA[Logging]]></category>
		<category><![CDATA[SPDiagnosticsServiceBase]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=2133</guid>
		<description><![CDATA[With SharePoint 2010, Microsoft gave us a better framework for logging that SharePoint 2007, which relied on writing most of your own. Sadly, though, the SPDiagnosticsServiceBase does lack in a couple of areas. Consequently, I&#8217;ve ended up writing my own &#8230; <a href="http://www.novolocus.com/2011/06/27/my-logging-diagnostics-service-for-sharepoint-2010/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>With SharePoint 2010, Microsoft gave us a better framework for logging that SharePoint 2007, which relied on writing most of your own. Sadly, though, the <strong>SPDiagnosticsServiceBase </strong>does lack in a couple of areas. Consequently, I&#8217;ve ended up writing my own Diagnostics service to try and address those issues. I am far from the only one (See the references below), but I&#8217;d like to present <a href="http://www.novolocus.com/wp-content/uploads/2011/06/MyLogger.txt">what I&#8217;ve written</a>, not least &#8216;cos I&#8217;ve been meaning to blog about it for about 8 months.</p>
<p>First, though, let&#8217;s look at the limitations of the <strong><a href="http://msdn.microsoft.com/en-us/library/ee538293.aspx">SPDiagnosticsServiceBase</a></strong>.<span id="more-2133"></span></p>
<p>The first limitation is that although you can log with a call to <strong><a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.spdiagnosticsservicebase.writetrace.aspx">SPDiagnosticsService.Local.WriteTrace()</a></strong>, you kind of run into an immediate problem &#8211; what&#8217;s the bloody <strong><a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.spdiagnosticscategory.aspx">SPDiagnosticsCategory </a></strong>that you want to use?</p>
<p>Well, like most people, I guess I tried creating a new <strong>SPDiagnosticsCategory </strong>object, and handing that into the function. Sadly, though, <a href="http://jbaurle.wordpress.com/2011/01/16/how-to-implement-a-custom-sharepoint-2010-logging-service-for-uls-and-windows-event-log/">the logs come through empty, as Jurgen Baurle mentions</a>.</p>
<p>The problem is that the logging categories are used to control the levels of logging you set in the Central Administration &gt; Monitoring pages. In fact, there are two bits to this &#8211; a diagnostics service offers a number of <strong>SPDiagnosticsAreas</strong>, and those areas have a number of <strong>SPDiagnosticsCategories</strong>.</p>
<p><a href="http://www.novolocus.com/wp-content/uploads/2011/06/logging.png"><img class="alignnone size-medium wp-image-2134" title="logging" src="http://www.novolocus.com/wp-content/uploads/2011/06/logging-300x131.png" alt="" width="300" height="131" /></a></p>
<p>Worse, compared to 2007, at least, is that you can no longer &#8216;register&#8217; and &#8216;unregister&#8217; diagnostics categories from this central administration section. Essentially, your categories are build in &#8211; they&#8217;re either there &#8230; or they aren&#8217;t. This is an annoyance, as it means that I can&#8217;t write a single Logging class and use it in all my projects. Instead, you have to create an entire diagnostics service, based on the <strong>SPDiagnosticsServiceBase </strong>class.</p>
<p>Whatever solution I produced, I wanted it to be easy to modify and reuse for other projects that might demand a different diagnostics area or classes. You might notice, I used the singular &#8211; &#8220;area&#8221; there. That was deliberate. I figure, if I need more that one area, it should be simple to provide another entire diagnostics service.</p>
<p>Now, quite a lot of people have produced examples (see below), with discussion of their code, so I won&#8217;t go into that so much. What I&#8217;ve not seem much of, though, it the use of an enumeration for the call to the logging class. Often, people seem to pass strings to define the logging category. What if it&#8217;s invalid? What if there is a typo? Basically, I hate magic strings, so I used an enumeration to define my logging categories for my service:</p>
<pre class="brush: csharp; title: ; notranslate">public enum MyLoggerCategory
 {
 TimerJob = 1,
 FeatureReceiver = 10,
 EventHandler = 20,
 Webpart = 30,
 General = 40
 }</pre>
<p>And the method that returns my Diagnostics Area and Categories uses this enumeration to define the categories:</p>
<pre class="brush: csharp; title: ; notranslate">

protected override IEnumerable&lt;SPDiagnosticsArea&gt; ProvideAreas()
 {
 List&lt;SPDiagnosticsArea&gt; areas = new List&lt;SPDiagnosticsArea&gt;();
 List&lt;SPDiagnosticsCategory&gt; categories = new List&lt;SPDiagnosticsCategory&gt;();

 foreach (string catName in Enum.GetNames(typeof(MyLoggerCategory)))
 {
 uint catId = (uint)(int)Enum.Parse(typeof(MyLoggerCategory), catName);
 categories.Add(new SPDiagnosticsCategory(catName, TraceSeverity.Medium, EventSeverity.Error, 0, catId));
 }

areas.Add(new SPDiagnosticsArea(DiagnosticsAreaName, 0, 0, false, categories));
 return areas;
 }</pre>
<p>Cool.</p>
<p>The next quirk was that there are two methods one might want to use for logging. There is <strong><a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.spdiagnosticsservicebase.writetrace.aspx">WriteTrace()</a></strong>, which writes to the trace logs, and <strong><a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.spdiagnosticsservicebase.writeevent.aspx">WriteEvent()</a></strong>, which writes to the Windows event log, and the trace log. Yup, if you used both, you can end up writing to the ULS logs twice. I also don&#8217;t want to have to think about making two calls. I just want one call &#8211; &#8220;Make a record of this&#8221; &#8211; and have SharePoint sort out where it is written to.</p>
<p>A third point in this aspect of my design was that I don&#8217;t like making method calls with parameters to define the importance. Maybe it&#8217;s my Java heritage from a long time ago, but I prefer calls like Logger.Warning() to record a message at a &#8216;Warning&#8217; level of importance. It&#8217;s simpler, and easier to read.</p>
<p>Thus, I decided my service would have calls like Error(), Warning(), High() and Medium(). These would call an internal private method, specifying the appropriate EventSeverity and TraceSeverity settings. Methods like Error() would call my internal method with a TraceSeverity of &#8216;None&#8217;, and the call to WriteEvent() will also, as mentioned, write to the tracelogs anyway. Lower importance calls, like Medium() wouldn&#8217;t write to the Windows Event Log, so they have an EventSeverity of &#8216;none&#8217;, but an appropriate Traceseverity, so we log things correctly.</p>
<p>Great &#8211; but there is <em>another</em> problem. Writing to the Windows Event Log relies on there being an Event Source to write to. If there isn&#8217;t, WriteEvent() will try to create it. However, in some configuartion of SharePoint, the account making the logging call won&#8217;t have the privileges needed to create this Event Source.</p>
<p>The Event Source itself is really just a key in the Registry of the, so one could try to make sure that a highly privileged account is used to create it. However, you&#8217;ve then got the question &#8211; which server? Answer &#8211; all of them. Fun and games.</p>
<p><a href="http://jbaurle.wordpress.com/2011/01/16/how-to-implement-a-custom-sharepoint-2010-logging-service-for-uls-and-windows-event-log/">Jurgen Baurle&#8217;s example shows how</a>, when the Feature for registering the diagnostics service is run, he also tries to create the Registry key for each server in the farm. Kudos, that&#8217;s quite neat, but I&#8217;m still not sure I like it. What if someone adds a new server? Well, it wouldn&#8217;t get that key &#8211; and you&#8217;re back to square one.</p>
<p>Alternatively, <a href="http://blogs.msdn.com/b/chriskeyser/archive/2010/12/20/using-a-sharepoint-timer-job-to-deploy-settings-in-a-farm-for-registering-event-sources.aspx">one could use a Timer Job </a>configured to run on each server in the farm. That&#8217;s a pretty good approach &#8211; but heavyweight. A Timer Service, that&#8217;s going to run from time to time forever, just to set that registry key IF a new server is added? (Chris Keyser&#8217;s job runs once &#8211; but then you&#8217;ve got the same problem of adding<em> new</em> servers again).</p>
<p>So, for my little logger, I took the easy option. If there is a problem writing to the Windows Event log, make a note of it in the Trace log, and then output the original message to the Trace log too. It ain&#8217;t pretty, but it is simple.</p>
<p>And my final little bonus &#8211; I like to know the class and method that output my messages to my logs. It&#8217;s useful for debugging. So, the private method WriteLog uses reflection to walk back up the <strong>StackFrame </strong>to the method that called it, and then uses reflection to get the class and method information, and those get put into the message too. It&#8217;s much simpler than, as I&#8217;ve seen done (heck, done myself), passing the method name as a parameter to each logging call.</p>
<p>And there you have it. You&#8217;ve now got something that you can make a call like:</p>
<pre class="brush: csharp; title: ; notranslate">MyLogger.Error( MyLoggerCategory.General, &quot;My Message&quot; );</pre>
<p>&#8230; and the rest is dealt with.</p>
<p>You can download <a href="http://www.novolocus.com/wp-content/uploads/2011/06/MyLogger.txt">MyLogger.cs here</a>. And to register or unregister it, you&#8217;ll need a Feature Receiver, something like <a href="http://www.novolocus.com/wp-content/uploads/2011/06/MyLoggerFeatureReceiver.txt">MyLoggerFeatureReceiver.cs</a>.</p>
<p>References:</p>
<ul>
<li><strong><a href="http://msdn.microsoft.com/en-us/library/gg512103.aspx">Debugging and Logging Capabilities in SharePoint 2010</a></strong> on MSDN</li>
<li><strong><a href="http://jbaurle.wordpress.com/2011/01/16/how-to-implement-a-custom-sharepoint-2010-logging-service-for-uls-and-windows-event-log/">How To Implement A Custom SharePoint 2010 Logging Service For ULS And Windows Event Log</a></strong> by Jurgen Baurle</li>
<li><a href="http://blogs.technet.com/b/speschka/archive/2011/01/23/tips-for-uls-logging.aspx"><strong>Tips for ULS Logging Part 1</strong></a> &amp; <a href="http://blogs.technet.com/b/speschka/archive/2011/02/04/tips-for-uls-logging-part-2.aspx"><strong>Part 2</strong></a> by Steve Peschka</li>
<li><a href="http://todd-carter.com/post/2010/12/17/Yuletide-ULS.aspx"><strong>YuleTide ULS</strong></a><strong> </strong>by Todd Carter</li>
<li><strong><a href="http://blog.mastykarz.nl/logging-uls-sharepoint-2010/">Logging to ULS in SharePoint 2010</a></strong> by Waldek Mastykarz</li>
<li><strong><a href="http://blogs.msdn.com/b/chriskeyser/archive/2010/12/20/using-a-sharepoint-timer-job-to-deploy-settings-in-a-farm-for-registering-event-sources.aspx">Using a SharePoint Timer Job to deploy settings in a farm for registering event sources </a></strong>by Chris Keyser</li>
<li><strong><a title="Permanent link to Using a Timer Job to ensure diagnostic areas of SPGuidance" rel="bookmark" href="http://patrickboom.wordpress.com/2010/11/23/using-a-timer-job-to-ensure-diagnostic-areas-of-spguidance/">Using a Timer Job to ensure diagnostic areas of SPGuidance</a></strong> by Patrick Boom</li>
</ul>
<img src="http://feeds.feedburner.com/~r/novolocus/~4/pEbXLNrqbX0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2011/06/27/my-logging-diagnostics-service-for-sharepoint-2010/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://www.novolocus.com/2011/06/27/my-logging-diagnostics-service-for-sharepoint-2010/</feedburner:origLink></item>
		<item>
		<title>Set the Title of a ListViewWebPart</title>
		<link>http://feedproxy.google.com/~r/novolocus/~3/ybuTk1e2XTE/</link>
		<comments>http://www.novolocus.com/2011/06/14/set-the-title-of-a-listviewwebpart/#comments</comments>
		<pubDate>Tue, 14 Jun 2011 11:15:22 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Development 2010]]></category>
		<category><![CDATA[ListViewWebPart]]></category>
		<category><![CDATA[Web Parts]]></category>
		<category><![CDATA[XsltListViewWebPart]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=2120</guid>
		<description><![CDATA[Something that has bothered me repeatedly in the past is that ListViewWebParts didn&#8217;t seem to allow their titles to be set via CAML. The View element for a site (i.e. in the ONET.xml file) doesn&#8217;t have a title element, and &#8230; <a href="http://www.novolocus.com/2011/06/14/set-the-title-of-a-listviewwebpart/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Something that has bothered me repeatedly in the past is that <strong>ListViewWebParts </strong>didn&#8217;t seem to allow their titles to be set via CAML. The <a href="http://msdn.microsoft.com/en-us/library/ms438074.aspx"><strong>View </strong>element for a site</a> (i.e. in the ONET.xml file) doesn&#8217;t have a title element, and the &#8216;Name&#8217; and &#8216;DisplayName&#8217; elements don&#8217;t set the web part&#8217;s title. Instead, the <strong>ListViewWebPart </strong>always seemed to pick up the name of the list it referred to. This was a problem if you had a page that showed two <strong>ListViewWebParts </strong>refering to the same list. E.g.:</p>
<pre class="brush: xml; title: ; notranslate">&lt;View List=&quot;Lists/Tasks&quot; BaseViewID=&quot;7&quot; WebPartZoneID=&quot;Left&quot; WebPartOrder=&quot;5&quot; /&gt;
&lt;View List=&quot;Lists/Tasks&quot; BaseViewID=&quot;9&quot; WebPartZoneID=&quot;Left&quot; WebPartOrder=&quot;6&quot; /&gt;</pre>
<p>would result in:</p>
<p><a href="http://www.novolocus.com/wp-content/uploads/2011/06/ListViewWebPart-Title-Problem.png"><img class="alignnone size-medium wp-image-2121" title="ListViewWebPart Title Problem" src="http://www.novolocus.com/wp-content/uploads/2011/06/ListViewWebPart-Title-Problem-300x196.png" alt="" width="300" height="196" /></a></p>
<p>How can we set those titles to be different?<span id="more-2120"></span></p>
<p>With other web parts, it wouldn&#8217;t be a problem. When adding them to a page in the ONET.xml file, you specify what the webpart&#8217;s assembly, class and properties all are:</p>
<pre class="brush: xml; title: ; notranslate">&lt;AllUsersWebPart List=&quot;301&quot; WebPartZoneID=&quot;BlogNavigator&quot; WebPartOrder=&quot;2&quot;&gt;
 &lt;![CDATA[
 &lt;WebPart xmlns=&quot;http://schemas.microsoft.com/WebPart/v2&quot;&gt;
 &lt;Assembly&gt;Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c&lt;/Assembly&gt;
 &lt;TypeName&gt;Microsoft.SharePoint.WebPartPages.BlogMonthQuickLaunch&lt;/TypeName&gt;
 &lt;Title&gt;My Title Here&lt;/Title&gt;
 &lt;/WebPart&gt;
 ]]&gt;
&lt;/AllUsersWebPart&gt;</pre>
<p>Great. But nothing in the CAML documentation says that you can do this with a <strong>&lt;View&gt;</strong> element, just within <strong>&lt;AllUsersWebPart&gt;</strong> elements. But what if you can? I did a regex search over 14 Hive, and found the following example:</p>
<pre class="brush: xml; title: ; notranslate">&lt;View List=&quot;303&quot; BaseViewID=&quot;0&quot; WebPartZoneID=&quot;BlogNavigator&quot; WebPartOrder=&quot;1&quot;&gt;
 &lt;![CDATA[
 &lt;webParts&gt;
 &lt;webPart xmlns=&quot;http://schemas.microsoft.com/WebPart/v3&quot;&gt;
 &lt;metaData&gt;
 &lt;type name=&quot;Microsoft.SharePoint.WebPartPages.XsltListViewWebPart,Microsoft.SharePoint,Version=14.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c&quot; /&gt;
 &lt;importErrorMessage&gt;Cannot import this Web Part.&lt;/importErrorMessage&gt;
 &lt;/metaData&gt;
 &lt;data&gt;
 &lt;properties&gt;
 &lt;property name=&quot;AllowConnect&quot; type=&quot;bool&quot;&gt;True&lt;/property&gt;
 &lt;property name=&quot;ChromeType&quot; type=&quot;chrometype&quot;&gt;None&lt;/property&gt;
 &lt;/properties&gt;
 &lt;/data&gt;
 &lt;/webPart&gt;
 &lt;/webParts&gt;
 ]]&gt;
&lt;/View&gt;</pre>
<p>Ooo &#8211; interesting. This isn&#8217;t quite what I need &#8211; it&#8217;s using the <strong>XsltListViewWebPart</strong>, and unfortunately I&#8217;m dealing with an old SharePoint 2007-type list. I wondered, though &#8211; would the same approach work with the <strong>ListViewWebPart</strong>?</p>
<p>Well, a quick search turned up the answer &#8211; <a href="http://blog.jussipalo.com/2007/04/moss-setting-list-view-title-in-onetxml.html">a definite yes </a>- and I wish I&#8217;d known about this 3 years ago. The following form of web part declaration:</p>
<pre class="brush: xml; title: ; notranslate">&lt;View List=&quot;Lists/Tasks&quot; BaseViewID=&quot;7&quot; WebPartZoneID=&quot;Left&quot; WebPartOrder=&quot;5&quot;&gt;
 &lt;![CDATA[
 &lt;WebPart xmlns=&quot;http://schemas.microsoft.com/WebPart/v2&quot;&gt;
 &lt;Assembly&gt;Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral,
 PublicKeyToken=71e9bce111e9429c&lt;/Assembly&gt;
 &lt;TypeName&gt;Microsoft.SharePoint.WebPartPages.ListViewWebPart&lt;/TypeName&gt;
 &lt;Title&gt;Enquiry Tasks&lt;/Title&gt;
 &lt;/WebPart&gt;
 ]]&gt;
&lt;/View&gt;
&lt;View List=&quot;Lists/Tasks&quot; BaseViewID=&quot;9&quot; WebPartZoneID=&quot;Left&quot; WebPartOrder=&quot;6&quot;&gt;
 &lt;![CDATA[
 &lt;WebPart xmlns=&quot;http://schemas.microsoft.com/WebPart/v2&quot;&gt;
 &lt;Assembly&gt;Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral,
 PublicKeyToken=71e9bce111e9429c&lt;/Assembly&gt;
 &lt;TypeName&gt;Microsoft.SharePoint.WebPartPages.ListViewWebPart&lt;/TypeName&gt;
 &lt;Title&gt;Request Specific Tasks&lt;/Title&gt;
 &lt;/WebPart&gt;
 ]]&gt;
&lt;/View&gt;</pre>
<p>results in &#8230;</p>
<p><a href="http://www.novolocus.com/wp-content/uploads/2011/06/ListViewWebPart-Title-Solved.png"><img class="alignnone size-medium wp-image-2122" title="ListViewWebPart Title Solved" src="http://www.novolocus.com/wp-content/uploads/2011/06/ListViewWebPart-Title-Solved-300x151.png" alt="" width="300" height="151" /></a></p>
<p>Perfect! Problem solved, and now I can control all sorts of other settings (such as Chrome, or allowing close) for these web parts too!</p>
<p><strong>EDIT</strong>: I just found <a href="http://msdn.microsoft.com/en-us/library/ms441170.aspx">another example</a>, this time on MSDN. It&#8217;s even more minimal than the one I found in 14 - it doesn&#8217;t define an assembly or class. However, it <strong>does not work.</strong> I tested it, and got the error:</p>
<blockquote><p>The &lt;Assembly&gt; element is required. Add this element to the Web Part file (.dwp), and then try to import the Web Part.</p></blockquote>
<p>That&#8217;s a pretty clear error. So, do not follow that article, but use the fuller forms shown above.</p>
<p><strong>EDIT 2:</strong> I also note that the properties in my old-fashioned 2007 ListViewWebPart aren&#8217;t the same as in the 2010 XsltListViewWebPart &#8211; Sandeep <a href="http://snahta.blogspot.com/2009/07/setting-listview-webpart-properties-in.html">lists some of the properties available here</a>.</p>
<img src="http://feeds.feedburner.com/~r/novolocus/~4/ybuTk1e2XTE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2011/06/14/set-the-title-of-a-listviewwebpart/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://www.novolocus.com/2011/06/14/set-the-title-of-a-listviewwebpart/</feedburner:origLink></item>
		<item>
		<title>The X-SharePointHealthScore header</title>
		<link>http://feedproxy.google.com/~r/novolocus/~3/XocfCBAxH_w/</link>
		<comments>http://www.novolocus.com/2011/06/10/the-x-sharepointhealthscore-header/#comments</comments>
		<pubDate>Fri, 10 Jun 2011 13:33:29 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Development 2010]]></category>
		<category><![CDATA[HTTP]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=2116</guid>
		<description><![CDATA[A reminder to myself &#8211; there is a response header for SharePoint requests called the X-SharePointHealthScore. It indicates how stressed the server is with a score from zero (unstressed) to 10 (highly stressed). I first stumbled across it when debugging &#8230; <a href="http://www.novolocus.com/2011/06/10/the-x-sharepointhealthscore-header/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>A reminder to myself &#8211; there is a response header for SharePoint requests called the X-SharePointHealthScore. It indicates how stressed the server is with a score from zero (unstressed) to 10 (highly stressed). I first stumbled across it when debugging something in Fiddler, but others have written about it:</p>
<ul>
<li><a href="http://www.andrewconnell.com/blog/archive/2011/04/16/sharepoint-health-score-something-to-add-to-your-sharepoint-based.aspx">Andrew Connell</a> has a brief write up</li>
<li><a href="http://blogs.breezetraining.com.au/mickb/2011/01/27/SharePoint2010XSharePointHealthScoreWhatIsThis.aspx">Mick Breeze</a> dug into it with Reflector</li>
<li><a href="http://blog.michelbarneveld.nl/michel/archive/2009/11/08/x-sharepointhealthscore-a-new-sharepoint-2010-http-header.aspx">Michel Barneveld</a> seems to have found it the same way as I did &#8211; but looks at how it is calculated. He also describes how to force SharePoint to return a given value, in case you need to test something (like how your client code handles a stressed server)</li>
</ul>
<blockquote><p>So how do we test the loadbalancer if we set it up in this fashion? Do we need to DDoS a WFE?  There is a better way <img src='http://www.novolocus.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  There is a registry setting  that will override the Health Score and it will return the value from the registry.</p>
<p>Create a DWORD with the name <strong>ServerHealthScore </strong>in the following location: <strong>HKLM\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\14.0\WSS</strong> and give it the value you want.</p></blockquote>
<p>So what&#8217;s it useful for? Well, the main things that strike me would be:</p>
<ul>
<li>Server Monitoring &#8211; Pretty obvious, really.</li>
<li>Client Applications &#8211; Can warn or take corrective actions if the server is loaded and may implement throttling.</li>
<li>Client Side scripts &#8211; Similar to above, though I haven&#8217;t yet been able to figure out who you&#8217;d get this value in the Client Object Model. I&#8217;m assuming there is a way to get the response headers in the Client Object Model &#8211; otherwise you may have to use normal XMLHttpRequests if you want to see the response headers.</li>
</ul>
<img src="http://feeds.feedburner.com/~r/novolocus/~4/XocfCBAxH_w" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2011/06/10/the-x-sharepointhealthscore-header/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.novolocus.com/2011/06/10/the-x-sharepointhealthscore-header/</feedburner:origLink></item>
		<item>
		<title>CAML queries of Lookup columns support query by ID</title>
		<link>http://feedproxy.google.com/~r/novolocus/~3/nniDHIcLiAE/</link>
		<comments>http://www.novolocus.com/2011/06/06/caml-queries-of-lookup-columns-support-query-by-id/#comments</comments>
		<pubDate>Mon, 06 Jun 2011 10:51:58 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Development 2010]]></category>
		<category><![CDATA[CAML]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=2109</guid>
		<description><![CDATA[When you run a CAML query, you have to specifiy a value you&#8217;re searching for: Well, that&#8217;s fine, but what about lookup columns? They actually have 2 elements &#8211; the text, and an ID. E.g. You might have a lookup &#8230; <a href="http://www.novolocus.com/2011/06/06/caml-queries-of-lookup-columns-support-query-by-id/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>When you run a CAML query, you have to specifiy a value you&#8217;re searching for:</p>
<pre class="brush: csharp; title: ; notranslate">query.Query = &quot;&lt;Where&gt;&lt;Eq&gt;&lt;FieldRef Name='MyField' /&gt;&lt;Value Type='Text'&gt;WhatILookFor&lt;/Value&gt;&lt;/Eq&gt;&lt;/Where&gt;&quot;;</pre>
<p>Well, that&#8217;s fine, but what about lookup columns? They actually have 2 elements &#8211; the text, and an ID.</p>
<p>E.g. You might have a lookup to a &#8216;Country&#8217; list, and &#8220;United Kingdom&#8221; might be ID 45.</p>
<p>If I wanted to find items on my list that referenced the &#8220;United Kingdom&#8221; value, my query would be:</p>
<pre class="brush: csharp; title: ; notranslate">query.Query = &quot;&lt;Where&gt;&lt;Eq&gt;&lt;FieldRef Name='MyField' /&gt;&lt;Value Type='Lookup'&gt;United Kingdom&lt;/Value&gt;&lt;/Eq&gt;&lt;/Where&gt;&quot;;</pre>
<p>However, this doesn&#8217;t make much sense. The ID is our primary key to the &#8216;country&#8217; list. Why are we querying by value? I mean, if the United Kingdom had a revolution and suddenly became, say, the &#8216;United Republic&#8217;, all of my CAML queries would break.</p>
<p><em>(That might  be the least of my worries, but you get my point).</em></p>
<p>So, we&#8217;d like to query by ID. Well, you can -<a href="http://www.novolocus.com/2008/09/24/modify-listitem-display-to-show-referencing-items/"> I&#8217;ve mentioned it before</a>, and the <a href="http://msdn.microsoft.com/en-us/library/ms442728.aspx">MSDN documents neglect to mention it themselves</a>. There is a property on the FieldRef of <strong>LookupId</strong>. Set that to True, and you can query by ID.</p>
<pre class="brush: csharp; title: ; notranslate">query.Query = &quot;&lt;Where&gt;&lt;Eq&gt;&lt;FieldRef Name='MyField' LookupId='TRUE' /&gt;&lt;Value Type='Lookup'&gt;43&lt;/Value&gt;&lt;/Eq&gt;&lt;/Where&gt;&quot;;</pre>
<p><strong>Edit</strong>: One of my colleagues pointed out that in SharePoint 2010, if you update the text of a referenced item, it is updated within the items that reference it. This is different to SharePoint 2007, where the referencing items retained the original text value. He&#8217;s right &#8211; but I&#8217;d still prefer to query by ID as it&#8217;s indexed, unique, and simple.</p>
<img src="http://feeds.feedburner.com/~r/novolocus/~4/nniDHIcLiAE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2011/06/06/caml-queries-of-lookup-columns-support-query-by-id/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.novolocus.com/2011/06/06/caml-queries-of-lookup-columns-support-query-by-id/</feedburner:origLink></item>
	</channel>
</rss>

