<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>The SharePoint Follies</title>
	<atom:link href="http://sharepointfollies.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://sharepointfollies.wordpress.com</link>
	<description>Adventures in the belly of the SharePoint beast</description>
	<lastBuildDate>Sun, 10 May 2009 03:47:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='sharepointfollies.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>The SharePoint Follies</title>
		<link>http://sharepointfollies.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://sharepointfollies.wordpress.com/osd.xml" title="The SharePoint Follies" />
	<atom:link rel='hub' href='http://sharepointfollies.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Develop SharePoint solutions with this 1 simple rule: Obey</title>
		<link>http://sharepointfollies.wordpress.com/2009/05/10/develop-sharepoint-solutions-with-this-1-simple-rule-obey/</link>
		<comments>http://sharepointfollies.wordpress.com/2009/05/10/develop-sharepoint-solutions-with-this-1-simple-rule-obey/#comments</comments>
		<pubDate>Sun, 10 May 2009 03:44:04 +0000</pubDate>
		<dc:creator>sharepointfollies</dc:creator>
				<category><![CDATA[Rants]]></category>

		<guid isPermaLink="false">http://sharepointfollies.wordpress.com/?p=50</guid>
		<description><![CDATA[Yes, I hate those kinds of ads too. But it seems like we constantly look for the quick and easy answer to solve our problems. With the ubiquity of advanced computer technology and portal/web application platforms like WSS/MOSS, we see so much potential to do more with less. I have been developing software for 23 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sharepointfollies.wordpress.com&amp;blog=7488568&amp;post=50&amp;subd=sharepointfollies&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Yes, I hate those kinds of ads too. But it seems like we constantly look for the quick and easy answer to solve our problems. With the ubiquity of advanced computer technology and portal/web application platforms like WSS/MOSS, we see so much potential to do more with less.</p>
<p>I have been developing software for 23 years now (perhaps for a lack of being able/allowed to do anything else marketable). Things have changed so fundamentally in that fairly short (at least to me) number of years:</p>
<ul>
<li>Access to information that helps us practitioners in our work, as it is being developed and as it changes. (The WWW, Google, etc.)</li>
<li>Development of new technologies and techniques to simplify the mechanics of software development and make it accessible to people who were not traditionally part of the IT &#8220;priesthood&#8221;. (PC&#8217;s, Object-Oriented Programming, new development methodologies, etc.)</li>
</ul>
<p>However, we become so concerned with the sizzle sometimes that we forget about the steak, and when that happens, we have a recipe for a poor project outcome. We like to show our clients how easy it is to do something in SharePoint, like create a custom list, add a column, change the name that appears in the column, add calculated fields and so forth. Why not? It is one of the very strengths of the platform.</p>
<p>Rewind back a few years to the days of the IT &#8220;priesthood&#8221;. The least little change required filling out forms in triplicate and sending them to various departments for review (hopefully, the department head wasn&#8217;t on vacation or ill!) This grew from IT&#8217;s responsibility to ensure system integrity; therefore, they were given the authority to put controls in place to help ensure that integrity.  We want to let users do things for themselves that they had to rely on us to do before, because it takes time away from our &#8220;important&#8221; work, and the users tend to have an inflated sense of where their problem fits in the grand scheme of things.  The users begin &#8220;doing [some of] the jobs we don&#8217;t want to do&#8221;, to borrow a catchphrase from the previous administration.</p>
<p>Don&#8217;t get me wrong, the very reason IT exists is to make our clients more productive and to help them make better decisions. I wouldn&#8217;t propose to limit our users&#8217; authorized activities to &#8220;free speech zones,&#8221; but to simply not allow them to carry weapons nearby that could kill the SharePoint beast and bring us all into that dark place with wailing and gnashing of teeth (not quite the boardroom scene with Donald Trump, but close enough.)</p>
<p>My modest proposal involves taking a small step backward: moving to the place where users cannot, intentionally or otherwise, damage the normal operation of the system.</p>
<p>Perhaps if a user proposes a change to some field in a list somewhere, or a new workflow, or a new calculation, some process should take place to determine:</p>
<ul>
<li>Why the change is called for</li>
<li>Alternatives to the change</li>
<li>Impacts to other portions of the system</li>
<li>How to test the change</li>
<li>Contingency plans in case the change creates problems.</li>
</ul>
<p>I know, Software Development 101 stuff, right? Some will say, &#8220;But we&#8217;re not writing code here; it should just work.&#8221; To clear the misconception, code is being written on your behalf when you do these things, and all code has bugs. (The last release of IBM&#8217;s OS/360 had over <strong>13,000</strong> <em>known</em> bugs.) As far as &#8220;just working&#8221; is concerned, even that requires work.</p>
<p>As we begin developing SharePoint solutions for mission-critical applications (I would not comfortably recommend this to <em>any</em> client), we do our clients a disservice when we fail to introduce rigorous controls into the process. We would do this for any other application platform; SharePoint should never get a free pass just because it&#8217;s new(er).</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sharepointfollies.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sharepointfollies.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sharepointfollies.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sharepointfollies.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sharepointfollies.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sharepointfollies.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sharepointfollies.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sharepointfollies.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sharepointfollies.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sharepointfollies.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sharepointfollies.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sharepointfollies.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sharepointfollies.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sharepointfollies.wordpress.com/50/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sharepointfollies.wordpress.com&amp;blog=7488568&amp;post=50&amp;subd=sharepointfollies&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sharepointfollies.wordpress.com/2009/05/10/develop-sharepoint-solutions-with-this-1-simple-rule-obey/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/aea3c12652ebadb85f682f477d349ffb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sharepointfollies</media:title>
		</media:content>
	</item>
		<item>
		<title>SharePoint 2007 Development Tools</title>
		<link>http://sharepointfollies.wordpress.com/2009/05/04/sharepoint-2007-development-tools/</link>
		<comments>http://sharepointfollies.wordpress.com/2009/05/04/sharepoint-2007-development-tools/#comments</comments>
		<pubDate>Mon, 04 May 2009 14:42:40 +0000</pubDate>
		<dc:creator>sharepointfollies</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://sharepointfollies.wordpress.com/?p=45</guid>
		<description><![CDATA[Adnan Ahmed is developing a list of development tools for SharePoint 2007. It has all the tools I&#8217;ve been using, plus quite a few more. Time to start downloading&#8230;!<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sharepointfollies.wordpress.com&amp;blog=7488568&amp;post=45&amp;subd=sharepointfollies&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.mossgurus.com/default.aspx">Adnan Ahmed</a> is developing a <a href="http://www.mossgurus.com/adnan/Lists/Posts/Post.aspx?ID=21">list of development tools</a> for SharePoint 2007. It has all the tools I&#8217;ve been using, plus quite a few more. Time to start downloading&#8230;!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sharepointfollies.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sharepointfollies.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sharepointfollies.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sharepointfollies.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sharepointfollies.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sharepointfollies.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sharepointfollies.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sharepointfollies.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sharepointfollies.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sharepointfollies.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sharepointfollies.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sharepointfollies.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sharepointfollies.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sharepointfollies.wordpress.com/45/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sharepointfollies.wordpress.com&amp;blog=7488568&amp;post=45&amp;subd=sharepointfollies&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sharepointfollies.wordpress.com/2009/05/04/sharepoint-2007-development-tools/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/aea3c12652ebadb85f682f477d349ffb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sharepointfollies</media:title>
		</media:content>
	</item>
		<item>
		<title>&#8220;Objectifying&#8221; SharePoint Event Receivers</title>
		<link>http://sharepointfollies.wordpress.com/2009/05/02/objectifying-sharepoint-event-receivers/</link>
		<comments>http://sharepointfollies.wordpress.com/2009/05/02/objectifying-sharepoint-event-receivers/#comments</comments>
		<pubDate>Sat, 02 May 2009 10:44:23 +0000</pubDate>
		<dc:creator>sharepointfollies</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://sharepointfollies.wordpress.com/?p=39</guid>
		<description><![CDATA[In the interest of improving the maintainability of a feature receiver that I wrote for a custom list, I decided to build classes that would be wrappers for the different types of SharePoint list items I referenced in the receiver. For example, if I had a custom list that represented locations in a warehouse that [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sharepointfollies.wordpress.com&amp;blog=7488568&amp;post=39&amp;subd=sharepointfollies&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In the interest of improving the maintainability of a feature receiver that I wrote for a custom list, I decided to build classes that would be wrappers for the different types of SharePoint list items I referenced in the receiver. For example, if I had a custom list that represented locations in a warehouse that included location and bin number, I would create a class containing those members and also include methods in the class to get/set corresponding data in the SharePoint list item.</p>
<p>In our example, I would call the class <code>WarehouseLocation</code>; include properties <code>Location</code>, <code>BinNumber</code>, and <code>Id</code> (to correspond to the <code>ID</code> of the list item); and then include a <code>GetWarehouseLocationById</code> method to retrieve a single warehouse location by the specified list item ID. If the warehouse location needs to be updated, a method called <code>UpdateWarehouseLocation</code> could update the warehouse location list item according to the contents of the <code>WarehouseLocation</code> object.</p>
<p>To simplify maintainability, I also like to create string constants that identify internal field names for the columns in the list as part of the object definition. In this way, if I do have to change an internal field name that I am referencing, I will only have to make the change in one place. I would also make these string constants public so they can be referenced from related classes.</p>
<p>To take the &#8220;n-tier&#8221; concept further, much of the custom code that would be initiated by an event receiver, workflow, etc. would actually act on these business objects that are abstractions of SharePoint list items.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sharepointfollies.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sharepointfollies.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sharepointfollies.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sharepointfollies.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sharepointfollies.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sharepointfollies.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sharepointfollies.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sharepointfollies.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sharepointfollies.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sharepointfollies.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sharepointfollies.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sharepointfollies.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sharepointfollies.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sharepointfollies.wordpress.com/39/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sharepointfollies.wordpress.com&amp;blog=7488568&amp;post=39&amp;subd=sharepointfollies&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sharepointfollies.wordpress.com/2009/05/02/objectifying-sharepoint-event-receivers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/aea3c12652ebadb85f682f477d349ffb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sharepointfollies</media:title>
		</media:content>
	</item>
		<item>
		<title>Getting the last approved versions of list items</title>
		<link>http://sharepointfollies.wordpress.com/2009/04/27/getting-the-last-approved-versions-of-list-items/</link>
		<comments>http://sharepointfollies.wordpress.com/2009/04/27/getting-the-last-approved-versions-of-list-items/#comments</comments>
		<pubDate>Mon, 27 Apr 2009 21:13:09 +0000</pubDate>
		<dc:creator>sharepointfollies</dc:creator>
				<category><![CDATA[WSS Development]]></category>

		<guid isPermaLink="false">http://sharepointfollies.wordpress.com/?p=32</guid>
		<description><![CDATA[Hopefully, Microsoft will support this feature in WSS 4.0&#8230;maybe? But for now, we do what we must&#8230;. The problem is a familiar one for those who work in the document management world and need to get the last approved version of the list item. The SharePoint Object model gets us to the red zone, but [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sharepointfollies.wordpress.com&amp;blog=7488568&amp;post=32&amp;subd=sharepointfollies&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Hopefully, Microsoft will support this feature in WSS 4.0&#8230;maybe? But for now, we do what we must&#8230;.</p>
<p>The problem is a familiar one for those who work in the document management world and need to get the last approved version of the list item. The SharePoint Object model gets us to the red zone, but doesn&#8217;t bring us all the way to the goal line. To Microsoft&#8217;s credit, they understand it&#8217;s a problem and give us a <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splistitem.aspx">workaround</a>.</p>
<p>I wrote this function, based on Microsoft&#8217;s example, to return all of the items in a custom list that have at least one approved version. In that case, for each item, it will grab the last approved item and stuff it into a dataset. The data table will have the same name as the display name of the list.</p>
<p>And yes&#8230;it uses LINQ.</p>
<pre class="csharpcode">        <span class="kwrd">private</span> <span class="kwrd">static</span> DataSet GetListItemsWithLastApprovedVersions(SPWeb aWeb, <span class="kwrd">string</span> aListName)
        {
            SPList myList = aWeb.Lists[aListName];
            DataSet ds = <span class="kwrd">new</span> DataSet();

            DataTable dt = myList.Items.GetDataTable();
            dt.Rows.Clear();
            ds.Tables.Add(dt);

            DataTable aDataTable = ds.Tables[0];
            myList.Items.Cast&lt;SPListItem&gt;().Where(
                t =&gt; t.Versions.Cast&lt;SPListItemVersion&gt;().Any(
                    v =&gt; v.Level == SPFileLevel.Published)).ToList().
                    ForEach(t =&gt;
                    {
                        <span class="kwrd">int</span> aListItemId = t.ID;
                        SPListItemVersion lastApprovedVersion =
                            t.Versions.Cast&lt;SPListItemVersion&gt;().
                                Where(v =&gt; v.Level == SPFileLevel.Published).
                                OrderByDescending(v =&gt; v.VersionId).
                                First();
                        DataRow aRow = ds.Tables[0].NewRow();
                        ds.Tables[0].Rows.Add(aRow);
                        <span class="kwrd">foreach</span> (SPField aField <span class="kwrd">in</span> lastApprovedVersion.Fields)
                        {
                            <span class="kwrd">if</span> (aDataTable.Columns.Contains(aField.StaticName))
                                aRow[aField.StaticName] = lastApprovedVersion[aField.StaticName];
                        }
                        aRow.AcceptChanges();
                    }
            );

            <span class="kwrd">return</span> ds;
        }</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sharepointfollies.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sharepointfollies.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sharepointfollies.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sharepointfollies.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sharepointfollies.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sharepointfollies.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sharepointfollies.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sharepointfollies.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sharepointfollies.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sharepointfollies.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sharepointfollies.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sharepointfollies.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sharepointfollies.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sharepointfollies.wordpress.com/32/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sharepointfollies.wordpress.com&amp;blog=7488568&amp;post=32&amp;subd=sharepointfollies&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sharepointfollies.wordpress.com/2009/04/27/getting-the-last-approved-versions-of-list-items/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/aea3c12652ebadb85f682f477d349ffb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sharepointfollies</media:title>
		</media:content>
	</item>
		<item>
		<title>Code to generate SQL Server views for SharePoint Custom Lists</title>
		<link>http://sharepointfollies.wordpress.com/2009/04/25/code-to-generate-sql-server-views-for-sharepoint-custom-lists/</link>
		<comments>http://sharepointfollies.wordpress.com/2009/04/25/code-to-generate-sql-server-views-for-sharepoint-custom-lists/#comments</comments>
		<pubDate>Sat, 25 Apr 2009 13:53:09 +0000</pubDate>
		<dc:creator>sharepointfollies</dc:creator>
				<category><![CDATA[WSS Development]]></category>

		<guid isPermaLink="false">http://sharepointfollies.wordpress.com/?p=19</guid>
		<description><![CDATA[Not long after I started developing a SharePoint site as an application, the client asked me how he was going to be able to generate reports based on the SharePoint data. While there are quite a few third-party solutions available to help with this, they usually cost more than the client is willing to spend, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sharepointfollies.wordpress.com&amp;blog=7488568&amp;post=19&amp;subd=sharepointfollies&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Not long after I started developing a SharePoint site as an application, the client asked me how he was going to be able to generate reports based on the SharePoint data. While there are quite a few third-party solutions available to help with this, they usually cost more than the client is willing to spend, and some of them seem to introduce quirks of their own.</p>
<p>After some Googling, I noticed <a href="http://www.mssqltips.com/tip.asp?tip=1323">Rob Fisch&#8217;s page</a>, that describes how to query the UserData view. This view contains all of the content for all of the lists in the SharePoint content database, melded into a single table.</p>
<p>The Holy Grail for me was to create SQL Server views in the content database that would represent the data in my custom lists. In the SharePoint API, each list exposes a property called &#8220;SchemaXml&#8221;. Each &lt;Field&gt; element in in the SchemaXml property includes two attributes&#8211;one called &#8220;ColName&#8221; (the column name in UserData) and &#8220;DisplayName&#8221; (the user-specified column name in the SharePoint list.)</p>
<p>Below is the code I wrote to generate the views. I called this from the site provisioning code of my site definition:</p>
<p>Given the use of LINQ in these functions, I should point out that you need .NET 3.5 to make this work.</p>
<pre class="csharpcode"><span class="kwrd">using</span> System;
<span class="kwrd">using</span> System.Collections.Generic;
<span class="kwrd">using</span> System.Linq;
<span class="kwrd">using</span> System.Text;
<span class="kwrd">using</span> Microsoft.SharePoint;
<span class="kwrd">using</span> System.Data.SqlClient;
<span class="kwrd">using</span> System.Xml;

<span class="kwrd">namespace</span> CMSSiteDefinition
{
    <span class="kwrd">class</span> DBUtil
    {
        <span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">void</span> GetViewDDL(<span class="kwrd">string</span> listName, SPWeb theWeb, SqlConnection aConn)
        {
            SPList theList = theWeb.Lists[listName];
            XmlDocument aDoc = <span class="kwrd">new</span> XmlDocument();
            aDoc.LoadXml(theList.SchemaXml);
            Dictionary&lt;String, String&gt; fieldMap = <span class="kwrd">new</span> Dictionary&lt;<span class="kwrd">string</span>, <span class="kwrd">string</span>&gt;();
            IQueryable&lt;XmlElement&gt; fieldElements =
                Queryable.AsQueryable&lt;XmlElement&gt;(aDoc.GetElementsByTagName(<span class="str">"Field"</span>).Cast&lt;XmlElement&gt;())
                .Where(e =&gt; e.Attributes[<span class="str">"ColName"</span>] != <span class="kwrd">null</span> &amp;&amp; e.Attributes[<span class="str">"DisplayName"</span>].Value.Length &gt; 0);
            <span class="kwrd">int</span> longestColName = fieldElements.Max(e =&gt; e.Attributes[<span class="str">"ColName"</span>].Value.Length);
            fieldElements.ToList().ForEach(e =&gt;
            {
                fieldMap[e.Attributes[<span class="str">"DisplayName"</span>].Value] =
                    e.Attributes[<span class="str">"ColName"</span>].Value;
            });

            StringBuilder sql = <span class="kwrd">new</span> StringBuilder();
            <span class="kwrd">string</span> viewName = String.Format(<span class="str">"_rpt_{0}_vw"</span>, listName.Replace(<span class="str">" "</span>, String.Empty));
            sql.Append(<span class="kwrd">string</span>.Format(<span class="str">"IF OBJECT_ID(N'dbo.{0}', N'V') IS NOT NULL\n"</span>, viewName));
            sql.Append(<span class="kwrd">string</span>.Format(<span class="str">"DROP VIEW dbo.{0}"</span>, viewName));
            SqlCommand dropCmd = <span class="kwrd">new</span> SqlCommand(sql.ToString(), aConn);
            dropCmd.ExecuteNonQuery();
            sql.Length = 0;
            sql.Append(String.Format(<span class="str">"CREATE VIEW dbo.{0} AS SELECT"</span>, viewName));
            <span class="kwrd">bool</span> firstField = <span class="kwrd">true</span>;
            <span class="kwrd">foreach</span> (<span class="kwrd">string</span> aKey <span class="kwrd">in</span> fieldMap.Keys)
            {
                sql.Append(String.Format(<span class="str">"\n{0}\tUD.{1}\t[{2}]"</span>, !firstField ? <span class="str">","</span> : String.Empty,
                    fieldMap[aKey].PadRight(longestColName), aKey));
                firstField = <span class="kwrd">false</span>;
            }
            sql.Append(<span class="str">"\nFROM dbo.Lists LT INNER JOIN dbo.UserData UD ON LT.tp_ID = UD.tp_ListId"</span>);
            sql.Append(String.Format(<span class="str">"\nWHERE LT.tp_Title = '{0}'"</span>, listName));
            SqlCommand aCommand = <span class="kwrd">new</span> SqlCommand(sql.ToString(), aConn);
            aCommand.ExecuteNonQuery();
        }

        <span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">void</span> GenerateReportViews(SPWeb web, SPSite site)
        {
            <span class="rem">// Create views to be used in reports</span>
            SqlConnection aConn = <span class="kwrd">new</span> SqlConnection(site.ContentDatabase.DatabaseConnectionString);
            aConn.Open();

            <span class="rem">// Select generic lists to create views</span>
            IQueryable&lt;SPList&gt; genericLists = Queryable.AsQueryable&lt;SPList&gt;(web.Lists.Cast&lt;SPList&gt;())
                .Where(l =&gt; l.BaseTemplate == SPListTemplateType.GenericList);

            <span class="rem">// Call GetViewDDL to create view for each list</span>
            genericLists.ToList().ForEach(l =&gt; { GetViewDDL(l.Title, web, aConn); });

            aConn.Close();
        }

    }
}</pre>
<p>As an example, if your site had a custom list called &#8220;My Custom List&#8221;, a view would be created in the content database called <em>_rpt_MyCustomList_vw</em>.</p>
<p><strong>Note:</strong> If you have versioning enabled for the custom list, this resulting view will return all versions. If you only want the current version, you can modify the WHERE clause to include tp_IsCurrentVersion = 1.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sharepointfollies.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sharepointfollies.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sharepointfollies.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sharepointfollies.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sharepointfollies.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sharepointfollies.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sharepointfollies.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sharepointfollies.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sharepointfollies.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sharepointfollies.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sharepointfollies.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sharepointfollies.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sharepointfollies.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sharepointfollies.wordpress.com/19/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sharepointfollies.wordpress.com&amp;blog=7488568&amp;post=19&amp;subd=sharepointfollies&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sharepointfollies.wordpress.com/2009/04/25/code-to-generate-sql-server-views-for-sharepoint-custom-lists/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/aea3c12652ebadb85f682f477d349ffb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sharepointfollies</media:title>
		</media:content>
	</item>
		<item>
		<title>Custom List Field Names</title>
		<link>http://sharepointfollies.wordpress.com/2009/04/24/custom-list-field-names/</link>
		<comments>http://sharepointfollies.wordpress.com/2009/04/24/custom-list-field-names/#comments</comments>
		<pubDate>Fri, 24 Apr 2009 16:51:49 +0000</pubDate>
		<dc:creator>sharepointfollies</dc:creator>
				<category><![CDATA[WSS Development]]></category>

		<guid isPermaLink="false">http://sharepointfollies.wordpress.com/?p=15</guid>
		<description><![CDATA[I spend most of my development time in SharePoint working with Item Event Receivers; someone adds a new custom list item or changes something in an existing list item, and my code responds to the event, many times by creating new items in another list or performing some sort of update to the existing list. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sharepointfollies.wordpress.com&amp;blog=7488568&amp;post=15&amp;subd=sharepointfollies&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I spend most of my development time in SharePoint working with Item Event Receivers; someone adds a new custom list item or changes something in an existing list item, and my code responds to the event, many times by creating new items in another list or performing some sort of update to the existing list.</p>
<p>Here&#8217;s a little bit of funkiness that can bite you if you aren&#8217;t looking for it: When you refer to a list item (<em>SPListItem</em>) in a custom list (<em>SPList</em>), both the SharePoint Object Model and web service expect you to specify the &#8220;internal name&#8221; for the field, which is not the same as the &#8220;display name&#8221;, which is the name SharePoint shows us in its web interface. SharePoint also lets you change the &#8220;display name&#8221; as much as you want, but leaves the &#8220;internal name&#8221; the same as it was when it was created originally.</p>
<p>I experienced this recently on a project where the SharePoint site was set up with a column with a display name of &#8220;Time in Days&#8221; when it was originally created. The customer decided to change the semantics of the column to mean hours instead of days, so the display name was changed to &#8220;Duration&#8221; but the internal name remained &#8220;Time_x0020_in_x0020_Days&#8221;.</p>
<p>In terms of preventing the application from throwing exceptions, it&#8217;s a good thing because the event receiver code will continue to refer to the same field. However, it creates an issue for anyone who has to maintain the receiver later on if (s)he isn&#8217;t aware of the meaning of the data in that field.</p>
<p>There are two &#8220;must-have&#8221; tools that allow you to see internal names for the fields and even test your SPQuery XML for correctness:</p>
<ul>
<li><a href="http://www.codeplex.com/SPCamlViewer">Stramit SharePoint 2007 Caml Viewer</a></li>
<li><a href="http://www.u2u.be/res/Tools/CamlQueryBuilder.aspx">U2U CAML Query Builder</a></li>
</ul>
<p>You can&#8217;t beat the price on these tools (Free) and they will save you time and sanity.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sharepointfollies.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sharepointfollies.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sharepointfollies.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sharepointfollies.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sharepointfollies.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sharepointfollies.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sharepointfollies.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sharepointfollies.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sharepointfollies.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sharepointfollies.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sharepointfollies.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sharepointfollies.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sharepointfollies.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sharepointfollies.wordpress.com/15/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sharepointfollies.wordpress.com&amp;blog=7488568&amp;post=15&amp;subd=sharepointfollies&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sharepointfollies.wordpress.com/2009/04/24/custom-list-field-names/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/aea3c12652ebadb85f682f477d349ffb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sharepointfollies</media:title>
		</media:content>
	</item>
		<item>
		<title>Reinstalling WSS on a development machine (part 2)</title>
		<link>http://sharepointfollies.wordpress.com/2009/04/24/reinstalling-wss-on-a-development-machine-part-2/</link>
		<comments>http://sharepointfollies.wordpress.com/2009/04/24/reinstalling-wss-on-a-development-machine-part-2/#comments</comments>
		<pubDate>Fri, 24 Apr 2009 15:22:22 +0000</pubDate>
		<dc:creator>sharepointfollies</dc:creator>
				<category><![CDATA[ASP.NET general]]></category>

		<guid isPermaLink="false">http://sharepointfollies.wordpress.com/?p=9</guid>
		<description><![CDATA[After getting the web application set up and creating a new site collection I got a &#8220;Server Application Unavailable&#8221; message as described here when I tried to browse to the new site collection&#8217;s URL. Server Application Unavailable The web application you are attempting to access on this web server is currently unavailable.  Please hit the &#8220;Refresh&#8221; button in [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sharepointfollies.wordpress.com&amp;blog=7488568&amp;post=9&amp;subd=sharepointfollies&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>After getting the web application set up and creating a new site collection I got a &#8220;Server Application Unavailable&#8221; message as described <a href="http://forums.asp.net/t/960370.aspx">here</a> when I tried to browse to the new site collection&#8217;s URL.</p>
<p><span style="font-family:Arial;color:#ff0000;font-size:x-large;">Server Application Unavailable</span></p>
<p><span style="font-family:Verdana;color:#000000;font-size:small;">The web application you are attempting to access on this web server is currently unavailable.  Please hit the &#8220;Refresh&#8221; button in your web browser to retry your request.</span></p>
<p><span style="font-size:x-small;"><strong>Administrator Note: </strong>An error message detailing the cause of this specific request failure can be found in the application event log of the web server. Please review this log entry to discover what caused this error to occur.</span></p>
<p>The application event log had a message with this description:</p>
<p>Description:<br />
Failed to execute request because the App-Domain could not be created. Error: 0&#215;80070005 Access is denied.</p>
<p>I had to give read/write permissions to the local IIS_WPG group in order to make this problem go away.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sharepointfollies.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sharepointfollies.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sharepointfollies.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sharepointfollies.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sharepointfollies.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sharepointfollies.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sharepointfollies.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sharepointfollies.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sharepointfollies.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sharepointfollies.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sharepointfollies.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sharepointfollies.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sharepointfollies.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sharepointfollies.wordpress.com/9/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sharepointfollies.wordpress.com&amp;blog=7488568&amp;post=9&amp;subd=sharepointfollies&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sharepointfollies.wordpress.com/2009/04/24/reinstalling-wss-on-a-development-machine-part-2/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/aea3c12652ebadb85f682f477d349ffb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sharepointfollies</media:title>
		</media:content>
	</item>
		<item>
		<title>Reinstalling WSS on a development machine</title>
		<link>http://sharepointfollies.wordpress.com/2009/04/24/reinstalling-wss-on-a-development-machine/</link>
		<comments>http://sharepointfollies.wordpress.com/2009/04/24/reinstalling-wss-on-a-development-machine/#comments</comments>
		<pubDate>Fri, 24 Apr 2009 14:48:28 +0000</pubDate>
		<dc:creator>sharepointfollies</dc:creator>
				<category><![CDATA[WSS Admin]]></category>

		<guid isPermaLink="false">http://sharepointfollies.wordpress.com/?p=3</guid>
		<description><![CDATA[I had to reinstall WSS 3.0 SP1 on my development VM, and Maxime&#8217;s post saved me a great deal of time. If you use &#8220;Standalone&#8221; mode instead of &#8220;Web front-end&#8221; mode, you will get the configuration database installed on the &#8220;windows internal&#8221; (SQL Server Embedded) database. That&#8217;s not what I want, because I want to use SQL [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sharepointfollies.wordpress.com&amp;blog=7488568&amp;post=3&amp;subd=sharepointfollies&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I had to reinstall WSS 3.0 SP1 on my development VM, and <a href="http://blog.decayingcode.com/2009/01/wsssharepoint-installation-stand-alone.html">Maxime&#8217;s post</a> saved me a great deal of time. If you use &#8220;Standalone&#8221; mode instead of &#8220;Web front-end&#8221; mode, you will get the configuration database installed on the &#8220;windows internal&#8221; (SQL Server Embedded) database. That&#8217;s not what I want, because I want to use SQL Server Express <em>at minimum</em> for my content and configuration databases.</p>
<p>Needless to say, I&#8217;m talking about a development environment here, and not production.</p>
<p>Thanks, Maxime!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sharepointfollies.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sharepointfollies.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sharepointfollies.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sharepointfollies.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sharepointfollies.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sharepointfollies.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sharepointfollies.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sharepointfollies.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sharepointfollies.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sharepointfollies.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sharepointfollies.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sharepointfollies.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sharepointfollies.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sharepointfollies.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sharepointfollies.wordpress.com&amp;blog=7488568&amp;post=3&amp;subd=sharepointfollies&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sharepointfollies.wordpress.com/2009/04/24/reinstalling-wss-on-a-development-machine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/aea3c12652ebadb85f682f477d349ffb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sharepointfollies</media:title>
		</media:content>
	</item>
	</channel>
</rss>
