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

<channel>
	<title>Aaron Robertson-Hodders SharePoint Blog</title>
	<atom:link href="http://vspug.com/aaronrh/feed/" rel="self" type="application/rss+xml" />
	<link>http://vspug.com/aaronrh</link>
	<description>Just another VSPUG - Virtual SharePoint User Group weblog</description>
	<lastBuildDate>Thu, 29 Jan 2009 20:53:00 +0000</lastBuildDate>
	<generator>http://vspug.com?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>SharePoint Dispose Checker &#8211; Even more useful than expected</title>
		<link>http://vspug.com/aaronrh/2009/01/29/sharepoint-dispose-checker-even-more-useful-than-expected/</link>
		<comments>http://vspug.com/aaronrh/2009/01/29/sharepoint-dispose-checker-even-more-useful-than-expected/#comments</comments>
		<pubDate>Thu, 29 Jan 2009 20:53:00 +0000</pubDate>
		<dc:creator>adrh</dc:creator>
		
		<guid isPermaLink="false"></guid>
		<description><![CDATA[By now you have probably heard that the SharePoint Dispose Checker has been released. It&#39;s an excellent tool for checking you are disposing of your SharePoint objects correctly!
I downloaded it this morning as soon as I read about it just to see if I have really been as conscientious as I thought I had. 
Turns [...]]]></description>
			<content:encoded><![CDATA[<p>By now you have probably heard that the <a title="SharePoint Dispose Checker" href="http://code.msdn.microsoft.com/SPDisposeCheck">SharePoint Dispose Checker</a> has been released. It&#39;s an excellent tool for checking you are disposing of your SharePoint objects correctly!</p>
<p>I downloaded it this morning as soon as I <a title="read" href="http://blogs.msdn.com/pandrew/archive/2009/01/29/spdisposecheck-v1-3-1-is-released.aspx">read</a> about it just to see if I have really been as conscientious as I thought I had. <img src="/emoticons/emotion-1.gif" alt="Smile" /></p>
<p>Turns out, according to the output from the tool that I have done a pretty good job of cleaning up after myself. In the 10,000 lines of code mostly devoted to interrogating the SharePoint structure there were only 15 issues raised and all but 2 were false positives &#8211; darn those UserProfile personal site objects!</p>
<p>What did surprise me was that the false positives were actually quite useful in bringing to light some areas of the code that <em>were</em> less than perfect. For example, where I had used two instances of the same site in the same code block where one would have sufficed or where although objects were disposed of in a finally block, there were instances where exceptions further up in the code could have lead to one of several objects not being disposed correctly. It also highlighted some areas where although there was a disposal in the finally block the code looked much neater if it was replaced with a using block.</p>
<p>I&#39;d recommend that you run the tool over your code no matter how careful you are for the review value alone. </p>
<p>I&#39;m going to put this into my projects build events &#8211; and if I get <em>really</em> keen perhaps I&#39;ll parse the output to remove the known false positives automatically.</p>
<p>I wonder why it won&#39;t run against the assemblies in the ISAPI directory&#8230; <img src="/emoticons/emotion-5.gif" alt="Wink" /></p>
]]></content:encoded>
			<wfw:commentRss>http://vspug.com/aaronrh/2009/01/29/sharepoint-dispose-checker-even-more-useful-than-expected/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SharePoint Dispose Checker &#8211; Even more useful than expected</title>
		<link>http://vspug.com/aaronrh/2009/01/29/sharepoint-dispose-checker-even-more-useful-than-expected/</link>
		<comments>http://vspug.com/aaronrh/2009/01/29/sharepoint-dispose-checker-even-more-useful-than-expected/#comments</comments>
		<pubDate>Thu, 29 Jan 2009 20:53:00 +0000</pubDate>
		<dc:creator>adrh</dc:creator>
		
		<guid isPermaLink="false"></guid>
		<description><![CDATA[By now you have probably heard that the SharePoint Dispose Checker has been released. It&#39;s an excellent tool for checking you are disposing of your SharePoint objects correctly!
I downloaded it this morning as soon as I read about it just to see if I have really been as conscientious as I thought I had. 
Turns [...]]]></description>
			<content:encoded><![CDATA[<p>By now you have probably heard that the <a title="SharePoint Dispose Checker" href="http://code.msdn.microsoft.com/SPDisposeCheck">SharePoint Dispose Checker</a> has been released. It&#39;s an excellent tool for checking you are disposing of your SharePoint objects correctly!</p>
<p>I downloaded it this morning as soon as I <a title="read" href="http://blogs.msdn.com/pandrew/archive/2009/01/29/spdisposecheck-v1-3-1-is-released.aspx">read</a> about it just to see if I have really been as conscientious as I thought I had. <img src="/emoticons/emotion-1.gif" alt="Smile" /></p>
<p>Turns out, according to the output from the tool that I have done a pretty good job of cleaning up after myself. In the 10,000 lines of code mostly devoted to interrogating the SharePoint structure there were only 15 issues raised and all but 2 were false positives &#8211; darn those UserProfile personal site objects!</p>
<p>What did surprise me was that the false positives were actually quite useful in bringing to light some areas of the code that <em>were</em> less than perfect. For example, where I had used two instances of the same site in the same code block where one would have sufficed or where although objects were disposed of in a finally block, there were instances where exceptions further up in the code could have lead to one of several objects not being disposed correctly. It also highlighted some areas where although there was a disposal in the finally block the code looked much neater if it was replaced with a using block.</p>
<p>I&#39;d recommend that you run the tool over your code no matter how careful you are for the review value alone. </p>
<p>I&#39;m going to put this into my projects build events &#8211; and if I get <em>really</em> keen perhaps I&#39;ll parse the output to remove the known false positives automatically.</p>
<p>I wonder why it won&#39;t run against the assemblies in the ISAPI directory&#8230; <img src="/emoticons/emotion-5.gif" alt="Wink" /></p>
]]></content:encoded>
			<wfw:commentRss>http://vspug.com/aaronrh/2009/01/29/sharepoint-dispose-checker-even-more-useful-than-expected/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Yet Another SharePoint Conference Post</title>
		<link>http://vspug.com/aaronrh/2008/02/26/yet-another-sharepoint-conference-post/</link>
		<comments>http://vspug.com/aaronrh/2008/02/26/yet-another-sharepoint-conference-post/#comments</comments>
		<pubDate>Tue, 26 Feb 2008 08:12:00 +0000</pubDate>
		<dc:creator>adrh</dc:creator>
		
		<guid isPermaLink="false"></guid>
		<description><![CDATA[Yep, BandWagon.JumpOn();!
I&#39;m off to Seattle on Sunday for the SharePoint Conference. 
Hopefully I&#39;ll be able to get in the door at Kells&#160;and put some faces to names! I&#39;ve never been there, but judging by the number of people interested, I hope they have a large place and a large supply of tasty bevies!
If you&#39;re going [...]]]></description>
			<content:encoded><![CDATA[<p>Yep, BandWagon.JumpOn();!</p>
<p>I&#39;m off to Seattle on Sunday for the <a href="http://www.mssharepointconference.com/Pages/default.aspx">SharePoint Conference</a>. </p>
<p>Hopefully I&#39;ll be able to get in the door at <a href="http://maps.live.com/?v=2&amp;sp=yp.YN926x15780632&amp;encType=1#">Kells</a>&nbsp;and put some faces to names! I&#39;ve never been there, but judging by the number of people <a href="http://www.mssharepointconference.com/Pages/default.aspx">interested</a>, I hope they have a large place and a large supply of tasty <a href="http://www.bevies.com/">bevies</a>!</p>
<p>If you&#39;re going up from down-under and willing to discuss how great the <a href="http://www.theblues.co.nz/index.html">Blues</a> look this season over a cold one, lemme know! <img src="/emoticons/emotion-1.gif" alt="Smile" /></p>
]]></content:encoded>
			<wfw:commentRss>http://vspug.com/aaronrh/2008/02/26/yet-another-sharepoint-conference-post/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Yet Another SharePoint Conference Post</title>
		<link>http://vspug.com/aaronrh/2008/02/26/yet-another-sharepoint-conference-post/</link>
		<comments>http://vspug.com/aaronrh/2008/02/26/yet-another-sharepoint-conference-post/#comments</comments>
		<pubDate>Tue, 26 Feb 2008 08:12:00 +0000</pubDate>
		<dc:creator>adrh</dc:creator>
		
		<guid isPermaLink="false"></guid>
		<description><![CDATA[Yep, BandWagon.JumpOn();!
I&#39;m off to Seattle on Sunday for the SharePoint Conference. 
Hopefully I&#39;ll be able to get in the door at Kells&#160;and put some faces to names! I&#39;ve never been there, but judging by the number of people interested, I hope they have a large place and a large supply of tasty bevies!
If you&#39;re going [...]]]></description>
			<content:encoded><![CDATA[<p>Yep, BandWagon.JumpOn();!</p>
<p>I&#39;m off to Seattle on Sunday for the <a href="http://www.mssharepointconference.com/Pages/default.aspx">SharePoint Conference</a>. </p>
<p>Hopefully I&#39;ll be able to get in the door at <a href="http://maps.live.com/?v=2&amp;sp=yp.YN926x15780632&amp;encType=1#">Kells</a>&nbsp;and put some faces to names! I&#39;ve never been there, but judging by the number of people <a href="http://www.mssharepointconference.com/Pages/default.aspx">interested</a>, I hope they have a large place and a large supply of tasty <a href="http://www.bevies.com/">bevies</a>!</p>
<p>If you&#39;re going up from down-under and willing to discuss how great the <a href="http://www.theblues.co.nz/index.html">Blues</a> look this season over a cold one, lemme know! <img src="/emoticons/emotion-1.gif" alt="Smile" /></p>
]]></content:encoded>
			<wfw:commentRss>http://vspug.com/aaronrh/2008/02/26/yet-another-sharepoint-conference-post/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>2008&#039;ified</title>
		<link>http://vspug.com/aaronrh/2008/02/26/</link>
		<comments>http://vspug.com/aaronrh/2008/02/26/#comments</comments>
		<pubDate>Tue, 26 Feb 2008 07:27:00 +0000</pubDate>
		<dc:creator>adrh</dc:creator>
		
		<guid isPermaLink="false"></guid>
		<description><![CDATA[Actually I&#39;ve been 2008&#39;ed for quite a while now, but only recently fully 2008&#39;rtm&#39;d! 
In a recent fit of over-exuberance (somewhat short of the Steve Ballmer opening keynote level mind you),&#160;I decided to embark on an upgrade journey. 
The plan was to upgrade the development environment for our Product&#39;s Server component (including SharePoint&#160;Solutions)&#160;to Visual Studio [...]]]></description>
			<content:encoded><![CDATA[<p>Actually I&#39;ve been 2008&#39;ed for quite a while now, but only recently fully 2008&#39;rtm&#39;d! </p>
<p>In a recent fit of over-exuberance (somewhat short of the Steve Ballmer opening keynote level mind you),&nbsp;I decided to embark on an upgrade journey. </p>
<p>The plan was to upgrade the development environment for our Product&#39;s Server component (including SharePoint&nbsp;Solutions)&nbsp;to Visual Studio 2008, nuke my Vista Machine and re-birth it as a Windows Server 2008 development machine &#8211; no more VPC dev for me! Oh, and just for kicks &#8211; move our projects from Team Foundation Server 2005 to 2008&#8230;</p>
<p>To be honest, I was kind of expecting <em>something</em> to go wrong so I backed up everything &#8211; the source, my development server (24Gb of VPC), my desktop and the VPC that TFS is running on.</p>
<p>I need not&nbsp;have bothered really (although something <em>would</em> have happened if I didn&#39;t) because it took me nearly as long to do all the backing up as it did to do the upgrades!</p>
<p>For Visual Studio 2005 -&gt; 2008 I checked out the project, opened&nbsp;it in VS 2008, let the wizard run, ignored a few warnings and voila &#8211; upgraded! This is a pretty complex sort of solution, made up of a dozen projects, tens of thousands of lines of code, custom targets and build events etc, and so I was a little uneasy until we&#39;d re-built and tested everything, but after some pretty thorough testing everything came through perfectly!</p>
<p>The desktop upgrade was also very smooth. Well, it was really a re-build from scratch, but the Features concept in Windows Server 2008 makes things a little quicker, and once I got over the issue of having to slipstream SP1 MOSS with the help of <a href="http://mindsharpblogs.com/ben/archive/2007/12/16/3837.aspx">this post</a> I was done. In search of the best possible experience (and so I didn&#39;t get Vista envy), I also ran through the tweaks provided <a href="http://blogs.msdn.com/vijaysk/archive/2008/02/11/using-windows-server-2008-as-a-super-desktop-os.aspx">here</a>. I noticed today that there are a few more in <a href="http://blogs.msdn.com/vijaysk/archive/2008/02/20/using-windows-server-2008-as-a-super-workstation-os-cont-d.aspx">Part 2</a> which look interesting like adjusting the priority for foreground tasks, but I&#39;m certainly not complaining. It performs very, very well &#8211; and it looks pretty. <img src="/emoticons/emotion-1.gif" alt="Smile" /></p>
<p>TFS it turned out was the easiest of the lot! I was <em>really</em> careful with this one, not only did I back up the databases, but I also made a copy of the VPC &#8211; just in case. I did a bit of trawling through the net to check for any nasty surprises, and I&#39;m sure&nbsp;that there are people for whom this has not been smooth sailing, but&nbsp;for me it was simply a matter of un-installing&nbsp;TFS 2005, without removing the database&nbsp;and installing 2008 &#8211; which prompted be to use the existing databases &#8211; and hey presto, 2008&#39;ified!!</p>
<p>In summary, I&#39;m extremely happy with the performance of the whole environment, the speed at which I was able to get set up with the latest and greatest and the lack of gotchas that often accompany these sorts of exercises!</p>
<p>[Feeling brave]And now lets migrate our Visual SourceSafe database&#8230;</p>
<p>&nbsp;</p>
<p style="MARGIN:0cm 0cm 0pt;"><font face="Times New Roman"></font>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://vspug.com/aaronrh/2008/02/26/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>2008&#039;ified</title>
		<link>http://vspug.com/aaronrh/2008/02/26/</link>
		<comments>http://vspug.com/aaronrh/2008/02/26/#comments</comments>
		<pubDate>Tue, 26 Feb 2008 07:27:00 +0000</pubDate>
		<dc:creator>adrh</dc:creator>
		
		<guid isPermaLink="false"></guid>
		<description><![CDATA[Actually I&#39;ve been 2008&#39;ed for quite a while now, but only recently fully 2008&#39;rtm&#39;d! 
In a recent fit of over-exuberance (somewhat short of the Steve Ballmer opening keynote level mind you),&#160;I decided to embark on an upgrade journey. 
The plan was to upgrade the development environment for our Product&#39;s Server component (including SharePoint&#160;Solutions)&#160;to Visual Studio [...]]]></description>
			<content:encoded><![CDATA[<p>Actually I&#39;ve been 2008&#39;ed for quite a while now, but only recently fully 2008&#39;rtm&#39;d! </p>
<p>In a recent fit of over-exuberance (somewhat short of the Steve Ballmer opening keynote level mind you),&nbsp;I decided to embark on an upgrade journey. </p>
<p>The plan was to upgrade the development environment for our Product&#39;s Server component (including SharePoint&nbsp;Solutions)&nbsp;to Visual Studio 2008, nuke my Vista Machine and re-birth it as a Windows Server 2008 development machine &#8211; no more VPC dev for me! Oh, and just for kicks &#8211; move our projects from Team Foundation Server 2005 to 2008&#8230;</p>
<p>To be honest, I was kind of expecting <em>something</em> to go wrong so I backed up everything &#8211; the source, my development server (24Gb of VPC), my desktop and the VPC that TFS is running on.</p>
<p>I need not&nbsp;have bothered really (although something <em>would</em> have happened if I didn&#39;t) because it took me nearly as long to do all the backing up as it did to do the upgrades!</p>
<p>For Visual Studio 2005 -&gt; 2008 I checked out the project, opened&nbsp;it in VS 2008, let the wizard run, ignored a few warnings and voila &#8211; upgraded! This is a pretty complex sort of solution, made up of a dozen projects, tens of thousands of lines of code, custom targets and build events etc, and so I was a little uneasy until we&#39;d re-built and tested everything, but after some pretty thorough testing everything came through perfectly!</p>
<p>The desktop upgrade was also very smooth. Well, it was really a re-build from scratch, but the Features concept in Windows Server 2008 makes things a little quicker, and once I got over the issue of having to slipstream SP1 MOSS with the help of <a href="http://mindsharpblogs.com/ben/archive/2007/12/16/3837.aspx">this post</a> I was done. In search of the best possible experience (and so I didn&#39;t get Vista envy), I also ran through the tweaks provided <a href="http://blogs.msdn.com/vijaysk/archive/2008/02/11/using-windows-server-2008-as-a-super-desktop-os.aspx">here</a>. I noticed today that there are a few more in <a href="http://blogs.msdn.com/vijaysk/archive/2008/02/20/using-windows-server-2008-as-a-super-workstation-os-cont-d.aspx">Part 2</a> which look interesting like adjusting the priority for foreground tasks, but I&#39;m certainly not complaining. It performs very, very well &#8211; and it looks pretty. <img src="/emoticons/emotion-1.gif" alt="Smile" /></p>
<p>TFS it turned out was the easiest of the lot! I was <em>really</em> careful with this one, not only did I back up the databases, but I also made a copy of the VPC &#8211; just in case. I did a bit of trawling through the net to check for any nasty surprises, and I&#39;m sure&nbsp;that there are people for whom this has not been smooth sailing, but&nbsp;for me it was simply a matter of un-installing&nbsp;TFS 2005, without removing the database&nbsp;and installing 2008 &#8211; which prompted be to use the existing databases &#8211; and hey presto, 2008&#39;ified!!</p>
<p>In summary, I&#39;m extremely happy with the performance of the whole environment, the speed at which I was able to get set up with the latest and greatest and the lack of gotchas that often accompany these sorts of exercises!</p>
<p>[Feeling brave]And now lets migrate our Visual SourceSafe database&#8230;</p>
<p>&nbsp;</p>
<p style="MARGIN:0cm 0cm 0pt;"><font face="Times New Roman"></font>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://vspug.com/aaronrh/2008/02/26/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Free SharePoint Business Data Catalog Column</title>
		<link>http://vspug.com/aaronrh/2007/12/20/</link>
		<comments>http://vspug.com/aaronrh/2007/12/20/#comments</comments>
		<pubDate>Thu, 20 Dec 2007 23:02:00 +0000</pubDate>
		<dc:creator>adrh</dc:creator>
		
		<guid isPermaLink="false"></guid>
		<description><![CDATA[I have decided to release the custom BDC column that I created to the public domain. This custom column type provides a BDC Column type that can be created at the Site Column level and therefore used in Site Content Types. Out of the box this is not possible, and the ability to reuse BDC [...]]]></description>
			<content:encoded><![CDATA[<p><span style="COLOR:#1f497d;"><font><font>I have decided to release the custom BDC column that I created to the public domain. This custom column type provides a </font></font></span><span style="COLOR:#1f497d;"><font><font>BDC Column type that can be created at the Site Column level and therefore used in Site Content Types. Out of the box this is not possible, and the ability to reuse BDC columns across sites and content has been identified as a common requirement. At this stage there are a number of things that are not yet implemented, including related fields, refreshing and nicer admin UI. However, I have created a <a href="http://www.codeplex.com/enhancedbdcfield">Project</a> on CodePlex so if you are interested in participating let me know! There is plenty of scope for features and function!</font></font></span></p>
<p><span style="COLOR:#1f497d;"><font><font>The new column is included in a SharePoint Solution (.wsp package) and can be deployed to SharePoint via the standard solution deployment framework.</font></font></span> </p>
<p><span style="COLOR:#1f497d;"><font><font>Once installed a new column type is available to be chosen when creating columns in lists and when creating site columns:</font></font></span></p>
<p><span style="COLOR:#1f497d;"><font><font></font></font></span></p>
<p><img src="/photos/aaronrh/images/10087/640x322.aspx" border="0" alt="  " /></p>
<p><span style="COLOR:#1f497d;"><font><font>When the BDC field type is selected the user is presented with a custom UI which displays all BDC Applications (and their Entities) registered on the current Server&#39;s Share Services Provider. The user also has the ability to set the fields that will be displayed in the Entity picker dialog when searching. </font></font></span></p>
<p><span style="COLOR:#1f497d;"><img src="/photos/aaronrh/images/10099/original.aspx" border="0" alt="  " /></span></p>
<p><span style="COLOR:#1f497d;"><font><font>&nbsp;<span style="COLOR:#1f497d;">Enough of the UI already, where&#39;s the code I hear you ask! &#8230;&nbsp;</span></font></font></span><span style="COLOR:#1f497d;"><font><font> </p>
<p><span><font color="#1f497d">To get the data for the Application and Entity drop downs, we query the BDC metadata:</font></span></p>
<blockquote>
<p><span><font color="#888888"><em>//Declare the relevent references</font><font color="#1f497d"><br />using Microsoft.Office.Server.ApplicationRegistry.Runtime;<br />using Microsoft.Office.Server.ApplicationRegistry.MetadataModel;</em></font></span></p>
</blockquote>
<p><span><font color="#1f497d">For the Applications.</font></span></p>
<blockquote>
<p><span><font color="#888888"><em>//Get the Line of Business Instances.</font><font color="#1f497d"><br />NamedLobSystemInstanceDictionary sysInstances = ApplicationRegistry.GetLobSystemInstances();<br />cboApplications.Items.Clear();</em></font></span></p>
<p><span><font color="#888888"><em>//Loop through their names and add them to the drop down.</font><font color="#1f497d"><br />foreach (String name in sysInstances.Keys)<br />{<br />&nbsp;cboApplications.Items.Add(name);<br />}</em></font></span></p>
</blockquote>
<p><span><font color="#1f497d">For the Entities, once an application is selected.</font></span></p>
<blockquote>
<p><span><font color="#1f497d"><em>LobSystemInstance currentInstance = sysInstances[cboApplications.SelectedValue];</em></font></span></p>
<p><span><font color="#888888"><em>//Get the Entities for the given Application.</font><font color="#1f497d"><br />NamedEntityDictionary currentEntities = currentInstance.GetEntities();</em></font></span></p>
<p><span><font color="#1f497d"><em>foreach (String name in currentEntities.Keys)<br />{<br />&nbsp;cboEntities.Items.Add(name);<br />}</em></font></span></p>
</blockquote>
<p><span><font color="#1f497d">Once created the column appears as a Site Column, and is available for use in Content Types.</font></span></p>
<p><span></span></p>
<p><span><img src="/photos/aaronrh/images/10091/original.aspx" border="0" alt="  " /></span></p>
<p><span></p>
<p><span style="COLOR:#1f497d;">When rendered in a list form, the field is very similar to the out of the box BDC column:</span></p>
<p><span style="COLOR:#1f497d;"><img src="/photos/aaronrh/images/10092/original.aspx" border="0" alt="  " /></span></span> </p>
<p><span></span></font></font></span>&nbsp;</p>
<p><span style="COLOR:#1f497d;"><font>The picker dialog used to find and select Entity items is almost identical to the standard SharePoint BDC Picker. This dialog is AJAX enabled so that if AJAX is enabled on the server the user will experience the AJAX feel, ie. no page refreshes for search and selection. The fall back if AJAX is not enabled is a standard aspx style form with full page refresh required for operations such as searching. There is a great blog entry from the Microsoft SharePoint Team (via Mike Ammerlaan&#39;s blog on the </font><a href="http://sharepoint.microsoft.com/blogs/mike/Lists/Posts/Post.aspx?ID=3"><font color="#0000ff">subject</font></a><font>) on </font><a href="http://blogs.msdn.com/sharepoint/archive/2007/03/02/integrating-asp-net-ajax-with-sharepoint.aspx"><font color="#0000ff">Integrating ASP.Net AJAX with SharePoint</font></a><font><font> that you should read if you want AJAX to be available on you SharePoint server. If you install your AJAX enabled solution on a server where this process is not complete, it should still function in the standard ASP.Net (ie. without AJAX) way. In theory, now that SP1 is out this is supported too, although I&#39;m not sure that configuring it is any easier&#8230;</font></font></span></p>
<p><span style="COLOR:#1f497d;"><font><font>The Pop Up is called via a JavaScript function on the book image above. This function build a URL based on the Application, Entity and Display Fields properties of the column. To save time and make the popup consistent with the standard UI, it is based on the pickerdialog.master Master page.</font></font></span> </p>
<p><span style="COLOR:#1f497d;"><font><font>The fields displayed in the list view are set when the column is defined, but can be modified once the column is created by editing the settings of the new column.</font></font></span></p>
<p><span style="COLOR:#1f497d;"><font><font><img src="/photos/aaronrh/images/10093/original.aspx" border="0" alt="  " /></font></font></span><span style="COLOR:#1f497d;"><font><font></font></font></span>&nbsp;<span style="COLOR:#1f497d;"><font><font></font></font></span><span style="COLOR:#1f497d;"><font><font></font></font></span><br /><span style="COLOR:#1f497d;"><font><font>We use the following code to get the list of Finders and populate the dropdown of fields to search on. Finders are defined in the XML definition of the Application and control the way data is retrieved from the external source in relation to searching.</font></font></span> </p>
<blockquote>
<p><span style="FONT-SIZE:9pt;COLOR:#1f497d;"><font><em>NamedLobSystemInstanceDictionary sysInstances = ApplicationRegistry.GetLobSystemInstances();</em></font></span></p>
<p><span style="FONT-SIZE:9pt;COLOR:#1f497d;"></span><span style="COLOR:#1f497d;"><font><em>LobSystemInstance myIns = sysInstances[Request["BDCApplication"]];</em></font></span></p>
<p><span style="FONT-SIZE:9pt;COLOR:#1f497d;"><font><em>Entity myEntity = myIns.GetEntities()[Request["BDCEntity"]];</em></font></span></p>
<p><span style="FONT-SIZE:9pt;COLOR:#1f497d;"><font><em>FilterCollection fc = myEntity.GetFinderFilters();</em></font></span></p>
</blockquote>
<p><span style="COLOR:#1f497d;"><font><font>The GridView containing the search results is contained within an AJAX UpdatePanel so that operations that would normally cause postback (and hence full page refreshes) are handled in the background. Inside the CreateChildControls we set up the AJAX UpdatePanel, GridView and Trigger Controls.</font></font></span></p>
<blockquote>
<p><span style="FONT-SIZE:9pt;COLOR:#1f497d;"><font><em>dvUpdatePanel = new System.Web.UI.UpdatePanel();</em></font></span></p>
<p><span style="FONT-SIZE:9pt;COLOR:#1f497d;"><font><em>ajaxScriptManager = new System.Web.UI.ScriptManager();<br />ajaxScriptManager.EnablePartialRendering = true;<br />Controls.Add(ajaxScriptManager);</em></font></span></p>
<p><span style="FONT-SIZE:9pt;COLOR:#1f497d;"><font><em>//Fixup the UpdatePanel. This function is defined in the blog from SharePoint Team on AJAX and SharePoint.<br />EnsureUpdatePanelFixups();</em></font></span></p>
<p><span style="FONT-SIZE:9pt;COLOR:#1f497d;"><font><em>//Create a conditional Update Panel and make sure the Children of the Panel cause updates.<br />dvUpdatePanel.UpdateMode = System.Web.UI.UpdatePanelUpdateMode.Conditional;<br />dvUpdatePanel.ChildrenAsTriggers = true;<br />dvUpdatePanel.ContentTemplateContainer.Controls.Add(gvResults);</em></font></span></p>
<p><span style="FONT-SIZE:9pt;COLOR:#1f497d;"><font><em>//Create a postback trigger on the search button to handle the search.<br />System.Web.UI.AsyncPostBackTrigger uptTrigger=new System.Web.UI.AsyncPostBackTrigger();<br />uptTrigger.ControlID = btnGoSearch.UniqueID;<br />uptTrigger.EventName = &quot;Click&quot;;<br />dvUpdatePanel.Triggers.Add(uptTrigger);</em></font></span></p>
<p><span style="FONT-SIZE:9pt;COLOR:#1f497d;"><font><em>//Set up a new SharePoint Grid View and turn off Auto Generate so we can control the columns.<br />gvResults = new SPGridView();<br />gvResults.ID=&quot;gvResults&quot;;<br />gvResults.AutoGenerateColumns = false;</em><br />&nbsp;</font></span></p>
</blockquote>
<p><span style="FONT-SIZE:9pt;COLOR:#1f497d;"><font size="+0"><font>Searching for Entities to show in the GridView is handled using the objects and methods provided by the SharePoint object model:</font></font></span></p>
<blockquote><p><span style="COLOR:#1f497d;"><font></p>
<blockquote>
<p><em>NamedLobSystemInstanceDictionary sysInstances = ApplicationRegistry.GetLobSystemInstances();<br />LobSystemInstance myIns = sysInstances[Request["BDCApplication"]];<br />Entity myEntity = myIns.GetEntities()[Request["BDCEntity"]];</em></p>
<p><em>//Build up a finder collection which is the query for the BDC source.<br />FilterCollection fc = myEntity.GetFinderFilters();</em></p>
<p><em>for (int&nbsp;iCounter = 0;&nbsp;iCounter &lt; fc.Count; iCounter++)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;if (fc[iCounter].Name == sFinderName || sFinderName == &quot;&quot;)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;switch (fc[iCounter].GetType().FullName)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;case &quot;Microsoft.Office.Server.ApplicationRegistry.Runtime.WildcardFilter&quot;:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;((WildcardFilter)fc[iCounter]).SystemIndependentValue = &quot;*&quot; + sQueryString + &quot;*&quot;;<br />&nbsp;&nbsp;&nbsp;&nbsp;break;<br />&nbsp;&nbsp;&nbsp;case &quot;Microsoft.Office.Server.ApplicationRegistry.Runtime.ComparisonFilter&quot;:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;((ComparisonFilter)fc[iCounter]).Value = Convert.ChangeType(sQueryString, ((ComparisonFilter)fc[iCounter]).GetFilterValueType());<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;break;<br />&nbsp;&nbsp;&nbsp;case &quot;Microsoft.Office.Server.ApplicationRegistry.Runtime.LimitFilter&quot;:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;((LimitFilter)fc[iCounter]).Value = Math.Min(0xc9, ((LimitFilter)fc[iCounter]).MaximumValue);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;break;<br />&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;}</em></p>
<p><em>IEntityInstanceEnumerator prodEntityInstanceEnumerator = myEntity.FindFiltered(fc, myIns);</em></p>
<p><em>//Create a data table to store the results.<br />DataTable Results = new DataTable(&quot;BDCData&quot;);<br />Resultset.Tables.Add(Results);</em></p>
<p><em>//Get the collection of IDs and create an array to store their names.<br />IdentifierCollection EntIDS = myEntity.GetIdentifiers();<br />string[] sIDNames = new string[EntIDS.Count];</em></p>
<p><em>//Get the names.<br />int nCounter = 0;</em></p>
<p><em>foreach (Identifier currentID in EntIDS)<br />{<br />&nbsp;sIDNames[nCounter] = currentID.Name;<br />&nbsp;nCounter++;<br />}</em></p>
<p><em>//Add columns to the results data table named as per the Entities fields.<br />//Check if there any of the fields have show in picker set so we know to display only those fields.<br />Boolean blnShowInPickers = false;<br />foreach (Field f in myEntity.GetFinderView().Fields)<br />&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;if (f.TypeDescriptor.GetProperties().ContainsKey(&quot;ShowInPicker&quot;))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;if (((Boolean)f.TypeDescriptor.GetProperties()[&quot;ShowInPicker&quot;]))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;blnShowInPickers = true;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;}<br />&nbsp;}</em></p>
<p><em>DataColumn currentColumn = null;<br />foreach (Field f in myEntity.GetFinderView().Fields)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;//Add the default display name to the caption if there is one so we can pull it out when we create the list.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;if (f.DefaultDisplayName == &quot;&quot;)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;currentColumn = Results.Columns.Add(f.Name);<br />&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;currentColumn = Results.Columns.Add(f.Name);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; currentColumn.Caption = f.DefaultDisplayName;<br />&nbsp;&nbsp;&nbsp;&nbsp; }</em></p>
<p><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (blnShowInPickers)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;//Only show fields that have show in picker set (if any do).<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;if (f.Name != sTitle)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;if (f.TypeDescriptor.GetProperties().ContainsKey(&quot;ShowInPicker&quot;))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;if (((Boolean)f.TypeDescriptor.GetProperties()[&quot;ShowInPicker&quot;]))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;currentColumn.ExtendedProperties.Add(&quot;ShowInPicker&quot;, &quot;TRUE&quot;);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;currentColumn.ExtendedProperties.Add(&quot;ShowInPicker&quot;, &quot;FALSE&quot;);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;currentColumn.ExtendedProperties.Add(&quot;ShowInPicker&quot;, &quot;TRUE&quot;);<br />&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;//Else if the field is an identifier or it&#39;s the title field then show it.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;if (f.TypeDescriptor.ContainsIdentifier || f.Name == sTitle)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;currentColumn.ExtendedProperties.Add(&quot;ShowInPicker&quot;, &quot;TRUE&quot;);<br />&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;currentColumn.ExtendedProperties.Add(&quot;ShowInPicker&quot;, &quot;FALSE&quot;);<br />&nbsp; &nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;}</em></p>
<p><em>//Loop through the found Entity instances and add them to the results.<br />while (prodEntityInstanceEnumerator.MoveNext())<br />{<br />&nbsp;try<br />&nbsp;{<br />&nbsp;&nbsp;IEntityInstance IE = prodEntityInstanceEnumerator.Current;<br />&nbsp;&nbsp;DataRow newResultRow = Results.NewRow();<br />&nbsp;&nbsp;System.Collections.IList MyList = (System.Collections.IList)IE.GetIdentifierValues();</em></p>
<p><em>&nbsp;&nbsp;//Create an array to hold the identifiers.<br />&nbsp;&nbsp;object[] oIdentitiers = new object[sIDNames.Length];</em></p>
<p><em>&nbsp;&nbsp;for (int iCounter = 0; iCounter &lt; MyList.Count; iCounter++)<br />&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;oIdentitiers[iCounter] = MyList[iCounter].ToString();<br />&nbsp;&nbsp;}</em></p>
<p><em>&nbsp;&nbsp;foreach (Field f in myEntity.GetFinderView().Fields)<br />&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;if (IE[f] != null)<br />&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;newResultRow[f.Name] = IE[f];<br />&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;}</em></p>
<p><em>&nbsp;&nbsp;Results.Rows.Add(newResultRow);<br />&nbsp;}</em></p>
<p><em>&nbsp;catch (Exception rowex)<br />&nbsp;{<br />&nbsp;}<br />}</em></p>
<p><em>//Grab the Display Fields and add columns for them in the Grid View.<br />gvResults.DataSource = Resultset;<br />string[] keys = Request[&quot;DisplayFields&quot;].ToUpper().Split(&#39;,&#39;);<br />gvResults.DataKeyNames = keys;<br />gvResults.Columns.Clear();</em></p>
<p><em>foreach (DataColumn currentCol in ((DataTable)gvResults.DataSource).Columns)<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; string[] displayFields = Request[&quot;DisplayFields&quot;].ToUpper().Split(&#39;,&#39;);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (Array.BinarySearch(displayFields,currentCol.ColumnName.ToString().ToUpper())&gt;=0)<br />&nbsp;&nbsp;<br />&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BoundField newfield=new BoundField();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; newfield.HeaderText=currentCol.ColumnName.ToString();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; newfield.DataField=currentCol.ColumnName.ToString();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;gvResults.Columns.Add(newfield);<br />&nbsp;}<br />}</em></p>
<p><em>//Bind the results to the grid.<br />gvResults.DataBind();</em></p>
</blockquote>
</blockquote>
<p><font>Feel free to wander over to CodePlex and grab a copy if this is a requirement for you or your clients and feel free to offer any suggestions you think of!</font><font> </font><font></p>
<p>I&#39;m off for a month with the Kids and the Family, so I wish you all a great Xmas, Holiday, or work time!</p>
<blockquote><p></font></span></p>
<p><span style="COLOR:#1f497d;"><font></font></span>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
</blockquote>
<p></font></p>
]]></content:encoded>
			<wfw:commentRss>http://vspug.com/aaronrh/2007/12/20/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Free SharePoint Business Data Catalog Column</title>
		<link>http://vspug.com/aaronrh/2007/12/20/</link>
		<comments>http://vspug.com/aaronrh/2007/12/20/#comments</comments>
		<pubDate>Thu, 20 Dec 2007 23:02:00 +0000</pubDate>
		<dc:creator>adrh</dc:creator>
		
		<guid isPermaLink="false"></guid>
		<description><![CDATA[I have decided to release the custom BDC column that I created to the public domain. This custom column type provides a BDC Column type that can be created at the Site Column level and therefore used in Site Content Types. Out of the box this is not possible, and the ability to reuse BDC [...]]]></description>
			<content:encoded><![CDATA[<p><span style="COLOR:#1f497d;"><font><font>I have decided to release the custom BDC column that I created to the public domain. This custom column type provides a </font></font></span><span style="COLOR:#1f497d;"><font><font>BDC Column type that can be created at the Site Column level and therefore used in Site Content Types. Out of the box this is not possible, and the ability to reuse BDC columns across sites and content has been identified as a common requirement. At this stage there are a number of things that are not yet implemented, including related fields, refreshing and nicer admin UI. However, I have created a <a href="http://www.codeplex.com/enhancedbdcfield">Project</a> on CodePlex so if you are interested in participating let me know! There is plenty of scope for features and function!</font></font></span></p>
<p><span style="COLOR:#1f497d;"><font><font>The new column is included in a SharePoint Solution (.wsp package) and can be deployed to SharePoint via the standard solution deployment framework.</font></font></span> </p>
<p><span style="COLOR:#1f497d;"><font><font>Once installed a new column type is available to be chosen when creating columns in lists and when creating site columns:</font></font></span></p>
<p><span style="COLOR:#1f497d;"><font><font></font></font></span></p>
<p><img src="/photos/aaronrh/images/10087/640x322.aspx" border="0" alt="  " /></p>
<p><span style="COLOR:#1f497d;"><font><font>When the BDC field type is selected the user is presented with a custom UI which displays all BDC Applications (and their Entities) registered on the current Server&#39;s Share Services Provider. The user also has the ability to set the fields that will be displayed in the Entity picker dialog when searching. </font></font></span></p>
<p><span style="COLOR:#1f497d;"><img src="/photos/aaronrh/images/10099/original.aspx" border="0" alt="  " /></span></p>
<p><span style="COLOR:#1f497d;"><font><font>&nbsp;<span style="COLOR:#1f497d;">Enough of the UI already, where&#39;s the code I hear you ask! &#8230;&nbsp;</span></font></font></span><span style="COLOR:#1f497d;"><font><font> </p>
<p><span><font color="#1f497d">To get the data for the Application and Entity drop downs, we query the BDC metadata:</font></span></p>
<blockquote>
<p><span><font color="#888888"><em>//Declare the relevent references</font><font color="#1f497d"><br />using Microsoft.Office.Server.ApplicationRegistry.Runtime;<br />using Microsoft.Office.Server.ApplicationRegistry.MetadataModel;</em></font></span></p>
</blockquote>
<p><span><font color="#1f497d">For the Applications.</font></span></p>
<blockquote>
<p><span><font color="#888888"><em>//Get the Line of Business Instances.</font><font color="#1f497d"><br />NamedLobSystemInstanceDictionary sysInstances = ApplicationRegistry.GetLobSystemInstances();<br />cboApplications.Items.Clear();</em></font></span></p>
<p><span><font color="#888888"><em>//Loop through their names and add them to the drop down.</font><font color="#1f497d"><br />foreach (String name in sysInstances.Keys)<br />{<br />&nbsp;cboApplications.Items.Add(name);<br />}</em></font></span></p>
</blockquote>
<p><span><font color="#1f497d">For the Entities, once an application is selected.</font></span></p>
<blockquote>
<p><span><font color="#1f497d"><em>LobSystemInstance currentInstance = sysInstances[cboApplications.SelectedValue];</em></font></span></p>
<p><span><font color="#888888"><em>//Get the Entities for the given Application.</font><font color="#1f497d"><br />NamedEntityDictionary currentEntities = currentInstance.GetEntities();</em></font></span></p>
<p><span><font color="#1f497d"><em>foreach (String name in currentEntities.Keys)<br />{<br />&nbsp;cboEntities.Items.Add(name);<br />}</em></font></span></p>
</blockquote>
<p><span><font color="#1f497d">Once created the column appears as a Site Column, and is available for use in Content Types.</font></span></p>
<p><span></span></p>
<p><span><img src="/photos/aaronrh/images/10091/original.aspx" border="0" alt="  " /></span></p>
<p><span></p>
<p><span style="COLOR:#1f497d;">When rendered in a list form, the field is very similar to the out of the box BDC column:</span></p>
<p><span style="COLOR:#1f497d;"><img src="/photos/aaronrh/images/10092/original.aspx" border="0" alt="  " /></span></span> </p>
<p><span></span></font></font></span>&nbsp;</p>
<p><span style="COLOR:#1f497d;"><font>The picker dialog used to find and select Entity items is almost identical to the standard SharePoint BDC Picker. This dialog is AJAX enabled so that if AJAX is enabled on the server the user will experience the AJAX feel, ie. no page refreshes for search and selection. The fall back if AJAX is not enabled is a standard aspx style form with full page refresh required for operations such as searching. There is a great blog entry from the Microsoft SharePoint Team (via Mike Ammerlaan&#39;s blog on the </font><a href="http://sharepoint.microsoft.com/blogs/mike/Lists/Posts/Post.aspx?ID=3"><font color="#0000ff">subject</font></a><font>) on </font><a href="http://blogs.msdn.com/sharepoint/archive/2007/03/02/integrating-asp-net-ajax-with-sharepoint.aspx"><font color="#0000ff">Integrating ASP.Net AJAX with SharePoint</font></a><font><font> that you should read if you want AJAX to be available on you SharePoint server. If you install your AJAX enabled solution on a server where this process is not complete, it should still function in the standard ASP.Net (ie. without AJAX) way. In theory, now that SP1 is out this is supported too, although I&#39;m not sure that configuring it is any easier&#8230;</font></font></span></p>
<p><span style="COLOR:#1f497d;"><font><font>The Pop Up is called via a JavaScript function on the book image above. This function build a URL based on the Application, Entity and Display Fields properties of the column. To save time and make the popup consistent with the standard UI, it is based on the pickerdialog.master Master page.</font></font></span> </p>
<p><span style="COLOR:#1f497d;"><font><font>The fields displayed in the list view are set when the column is defined, but can be modified once the column is created by editing the settings of the new column.</font></font></span></p>
<p><span style="COLOR:#1f497d;"><font><font><img src="/photos/aaronrh/images/10093/original.aspx" border="0" alt="  " /></font></font></span><span style="COLOR:#1f497d;"><font><font></font></font></span>&nbsp;<span style="COLOR:#1f497d;"><font><font></font></font></span><span style="COLOR:#1f497d;"><font><font></font></font></span><br /><span style="COLOR:#1f497d;"><font><font>We use the following code to get the list of Finders and populate the dropdown of fields to search on. Finders are defined in the XML definition of the Application and control the way data is retrieved from the external source in relation to searching.</font></font></span> </p>
<blockquote>
<p><span style="FONT-SIZE:9pt;COLOR:#1f497d;"><font><em>NamedLobSystemInstanceDictionary sysInstances = ApplicationRegistry.GetLobSystemInstances();</em></font></span></p>
<p><span style="FONT-SIZE:9pt;COLOR:#1f497d;"></span><span style="COLOR:#1f497d;"><font><em>LobSystemInstance myIns = sysInstances[Request["BDCApplication"]];</em></font></span></p>
<p><span style="FONT-SIZE:9pt;COLOR:#1f497d;"><font><em>Entity myEntity = myIns.GetEntities()[Request["BDCEntity"]];</em></font></span></p>
<p><span style="FONT-SIZE:9pt;COLOR:#1f497d;"><font><em>FilterCollection fc = myEntity.GetFinderFilters();</em></font></span></p>
</blockquote>
<p><span style="COLOR:#1f497d;"><font><font>The GridView containing the search results is contained within an AJAX UpdatePanel so that operations that would normally cause postback (and hence full page refreshes) are handled in the background. Inside the CreateChildControls we set up the AJAX UpdatePanel, GridView and Trigger Controls.</font></font></span></p>
<blockquote>
<p><span style="FONT-SIZE:9pt;COLOR:#1f497d;"><font><em>dvUpdatePanel = new System.Web.UI.UpdatePanel();</em></font></span></p>
<p><span style="FONT-SIZE:9pt;COLOR:#1f497d;"><font><em>ajaxScriptManager = new System.Web.UI.ScriptManager();<br />ajaxScriptManager.EnablePartialRendering = true;<br />Controls.Add(ajaxScriptManager);</em></font></span></p>
<p><span style="FONT-SIZE:9pt;COLOR:#1f497d;"><font><em>//Fixup the UpdatePanel. This function is defined in the blog from SharePoint Team on AJAX and SharePoint.<br />EnsureUpdatePanelFixups();</em></font></span></p>
<p><span style="FONT-SIZE:9pt;COLOR:#1f497d;"><font><em>//Create a conditional Update Panel and make sure the Children of the Panel cause updates.<br />dvUpdatePanel.UpdateMode = System.Web.UI.UpdatePanelUpdateMode.Conditional;<br />dvUpdatePanel.ChildrenAsTriggers = true;<br />dvUpdatePanel.ContentTemplateContainer.Controls.Add(gvResults);</em></font></span></p>
<p><span style="FONT-SIZE:9pt;COLOR:#1f497d;"><font><em>//Create a postback trigger on the search button to handle the search.<br />System.Web.UI.AsyncPostBackTrigger uptTrigger=new System.Web.UI.AsyncPostBackTrigger();<br />uptTrigger.ControlID = btnGoSearch.UniqueID;<br />uptTrigger.EventName = &quot;Click&quot;;<br />dvUpdatePanel.Triggers.Add(uptTrigger);</em></font></span></p>
<p><span style="FONT-SIZE:9pt;COLOR:#1f497d;"><font><em>//Set up a new SharePoint Grid View and turn off Auto Generate so we can control the columns.<br />gvResults = new SPGridView();<br />gvResults.ID=&quot;gvResults&quot;;<br />gvResults.AutoGenerateColumns = false;</em><br />&nbsp;</font></span></p>
</blockquote>
<p><span style="FONT-SIZE:9pt;COLOR:#1f497d;"><font size="+0"><font>Searching for Entities to show in the GridView is handled using the objects and methods provided by the SharePoint object model:</font></font></span></p>
<blockquote><p><span style="COLOR:#1f497d;"><font></p>
<blockquote>
<p><em>NamedLobSystemInstanceDictionary sysInstances = ApplicationRegistry.GetLobSystemInstances();<br />LobSystemInstance myIns = sysInstances[Request["BDCApplication"]];<br />Entity myEntity = myIns.GetEntities()[Request["BDCEntity"]];</em></p>
<p><em>//Build up a finder collection which is the query for the BDC source.<br />FilterCollection fc = myEntity.GetFinderFilters();</em></p>
<p><em>for (int&nbsp;iCounter = 0;&nbsp;iCounter &lt; fc.Count; iCounter++)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;if (fc[iCounter].Name == sFinderName || sFinderName == &quot;&quot;)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;switch (fc[iCounter].GetType().FullName)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;case &quot;Microsoft.Office.Server.ApplicationRegistry.Runtime.WildcardFilter&quot;:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;((WildcardFilter)fc[iCounter]).SystemIndependentValue = &quot;*&quot; + sQueryString + &quot;*&quot;;<br />&nbsp;&nbsp;&nbsp;&nbsp;break;<br />&nbsp;&nbsp;&nbsp;case &quot;Microsoft.Office.Server.ApplicationRegistry.Runtime.ComparisonFilter&quot;:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;((ComparisonFilter)fc[iCounter]).Value = Convert.ChangeType(sQueryString, ((ComparisonFilter)fc[iCounter]).GetFilterValueType());<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;break;<br />&nbsp;&nbsp;&nbsp;case &quot;Microsoft.Office.Server.ApplicationRegistry.Runtime.LimitFilter&quot;:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;((LimitFilter)fc[iCounter]).Value = Math.Min(0xc9, ((LimitFilter)fc[iCounter]).MaximumValue);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;break;<br />&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;}</em></p>
<p><em>IEntityInstanceEnumerator prodEntityInstanceEnumerator = myEntity.FindFiltered(fc, myIns);</em></p>
<p><em>//Create a data table to store the results.<br />DataTable Results = new DataTable(&quot;BDCData&quot;);<br />Resultset.Tables.Add(Results);</em></p>
<p><em>//Get the collection of IDs and create an array to store their names.<br />IdentifierCollection EntIDS = myEntity.GetIdentifiers();<br />string[] sIDNames = new string[EntIDS.Count];</em></p>
<p><em>//Get the names.<br />int nCounter = 0;</em></p>
<p><em>foreach (Identifier currentID in EntIDS)<br />{<br />&nbsp;sIDNames[nCounter] = currentID.Name;<br />&nbsp;nCounter++;<br />}</em></p>
<p><em>//Add columns to the results data table named as per the Entities fields.<br />//Check if there any of the fields have show in picker set so we know to display only those fields.<br />Boolean blnShowInPickers = false;<br />foreach (Field f in myEntity.GetFinderView().Fields)<br />&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;if (f.TypeDescriptor.GetProperties().ContainsKey(&quot;ShowInPicker&quot;))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;if (((Boolean)f.TypeDescriptor.GetProperties()[&quot;ShowInPicker&quot;]))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;blnShowInPickers = true;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;}<br />&nbsp;}</em></p>
<p><em>DataColumn currentColumn = null;<br />foreach (Field f in myEntity.GetFinderView().Fields)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;//Add the default display name to the caption if there is one so we can pull it out when we create the list.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;if (f.DefaultDisplayName == &quot;&quot;)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;currentColumn = Results.Columns.Add(f.Name);<br />&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;currentColumn = Results.Columns.Add(f.Name);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; currentColumn.Caption = f.DefaultDisplayName;<br />&nbsp;&nbsp;&nbsp;&nbsp; }</em></p>
<p><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (blnShowInPickers)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;//Only show fields that have show in picker set (if any do).<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;if (f.Name != sTitle)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;if (f.TypeDescriptor.GetProperties().ContainsKey(&quot;ShowInPicker&quot;))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;if (((Boolean)f.TypeDescriptor.GetProperties()[&quot;ShowInPicker&quot;]))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;currentColumn.ExtendedProperties.Add(&quot;ShowInPicker&quot;, &quot;TRUE&quot;);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;currentColumn.ExtendedProperties.Add(&quot;ShowInPicker&quot;, &quot;FALSE&quot;);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;currentColumn.ExtendedProperties.Add(&quot;ShowInPicker&quot;, &quot;TRUE&quot;);<br />&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;//Else if the field is an identifier or it&#39;s the title field then show it.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;if (f.TypeDescriptor.ContainsIdentifier || f.Name == sTitle)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;currentColumn.ExtendedProperties.Add(&quot;ShowInPicker&quot;, &quot;TRUE&quot;);<br />&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;currentColumn.ExtendedProperties.Add(&quot;ShowInPicker&quot;, &quot;FALSE&quot;);<br />&nbsp; &nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;}</em></p>
<p><em>//Loop through the found Entity instances and add them to the results.<br />while (prodEntityInstanceEnumerator.MoveNext())<br />{<br />&nbsp;try<br />&nbsp;{<br />&nbsp;&nbsp;IEntityInstance IE = prodEntityInstanceEnumerator.Current;<br />&nbsp;&nbsp;DataRow newResultRow = Results.NewRow();<br />&nbsp;&nbsp;System.Collections.IList MyList = (System.Collections.IList)IE.GetIdentifierValues();</em></p>
<p><em>&nbsp;&nbsp;//Create an array to hold the identifiers.<br />&nbsp;&nbsp;object[] oIdentitiers = new object[sIDNames.Length];</em></p>
<p><em>&nbsp;&nbsp;for (int iCounter = 0; iCounter &lt; MyList.Count; iCounter++)<br />&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;oIdentitiers[iCounter] = MyList[iCounter].ToString();<br />&nbsp;&nbsp;}</em></p>
<p><em>&nbsp;&nbsp;foreach (Field f in myEntity.GetFinderView().Fields)<br />&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;if (IE[f] != null)<br />&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;newResultRow[f.Name] = IE[f];<br />&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;}</em></p>
<p><em>&nbsp;&nbsp;Results.Rows.Add(newResultRow);<br />&nbsp;}</em></p>
<p><em>&nbsp;catch (Exception rowex)<br />&nbsp;{<br />&nbsp;}<br />}</em></p>
<p><em>//Grab the Display Fields and add columns for them in the Grid View.<br />gvResults.DataSource = Resultset;<br />string[] keys = Request[&quot;DisplayFields&quot;].ToUpper().Split(&#39;,&#39;);<br />gvResults.DataKeyNames = keys;<br />gvResults.Columns.Clear();</em></p>
<p><em>foreach (DataColumn currentCol in ((DataTable)gvResults.DataSource).Columns)<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; string[] displayFields = Request[&quot;DisplayFields&quot;].ToUpper().Split(&#39;,&#39;);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (Array.BinarySearch(displayFields,currentCol.ColumnName.ToString().ToUpper())&gt;=0)<br />&nbsp;&nbsp;<br />&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BoundField newfield=new BoundField();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; newfield.HeaderText=currentCol.ColumnName.ToString();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; newfield.DataField=currentCol.ColumnName.ToString();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;gvResults.Columns.Add(newfield);<br />&nbsp;}<br />}</em></p>
<p><em>//Bind the results to the grid.<br />gvResults.DataBind();</em></p>
</blockquote>
</blockquote>
<p><font>Feel free to wander over to CodePlex and grab a copy if this is a requirement for you or your clients and feel free to offer any suggestions you think of!</font><font> </font><font></p>
<p>I&#39;m off for a month with the Kids and the Family, so I wish you all a great Xmas, Holiday, or work time!</p>
<blockquote><p></font></span></p>
<p><span style="COLOR:#1f497d;"><font></font></span>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
</blockquote>
<p></font></p>
]]></content:encoded>
			<wfw:commentRss>http://vspug.com/aaronrh/2007/12/20/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Best Practice : Using disposable objects in SharePoint</title>
		<link>http://vspug.com/aaronrh/2007/11/13/</link>
		<comments>http://vspug.com/aaronrh/2007/11/13/#comments</comments>
		<pubDate>Tue, 13 Nov 2007 22:59:00 +0000</pubDate>
		<dc:creator>adrh</dc:creator>
		
		<guid isPermaLink="false"></guid>
		<description><![CDATA[I found this article on MSDN via Andrew&#39;s post posing the question &#34;So is it best practice to only use C# for SharePoint development?&#34;. A good question and one that will have plenty of comment from all I imagine. For what it&#39;s worth (although not the point of this post), I&#39;m a fan of C# [...]]]></description>
			<content:encoded><![CDATA[<p>I found <a href="http://msdn2.microsoft.com/en-gb/library/aa973248.aspx">this</a> article on MSDN via Andrew&#39;s <a href="http://www.21apps.com/2007/11/so-is-it-best-practice-to-only-use-c.html">post</a> posing the question &quot;So is it best practice to only use C# for SharePoint development?&quot;. A good question and one that will have plenty of comment from all I imagine. For what it&#39;s worth (although not the point of this post), I&#39;m a fan of C# because I like using (SPSite currentSite=new SPSite(<a href="http://server/">http://Server</a>)) &#8230;</p>
<p>The interesting thing I took from the MSDN article was that objects that are accessed via SPSite objects, like RootWeb and ParentWeb need to be <em>explicitly</em> disposed of when you&#39;re finished with them. I had not appreciated this. I figured that if you &#39;used&#39; <em>using</em> on the SPSite object then that would dispose all the members etc of that object. Not so say our MS friends! <img src="/emoticons/emotion-1.gif" alt="Smile" /></p>
<p>This means:</p>
<p><em>String str;<br /><span style="COLOR:blue;">using</span>(SPSite oSPSite = <span style="COLOR:blue;">new</span> SPSite(<span style="COLOR:maroon;">&quot;http:<span style="COLOR:green;">//server&quot;</span>))</span><br />{<br />&nbsp;&nbsp; str = oSPSite.RootWeb.Title;<br />&nbsp;&nbsp; str = oSPSite.RootWeb.Url;</p>
<p>&nbsp;&nbsp; &#8230; additional processing on RootWeb &#8230; </p>
<p>oSPSite.RootWeb.Dispose();<br />}<br /></em></p>
<p>And, in the interest of fairness:&nbsp;</p>
<p><em>Dim str as string<br />Dim oSPSite as SPSite</em></p>
<p><em>oSPSite=new SPSite(</em><a href="http://server/"><em>http://server</em></a><em>)</em></p>
<p><em>str = oSPSite.RootWeb.Title<br />str = oSPSite.RootWeb.Url</em></p>
<p><em>&#8230; additional processing on RootWeb &#8230; </em></p>
<p><em>oSPSite.RootWeb.Dispose()<br />oSPSite.Dispose()</em></p>
<p>Not really that difficult, but it will make a difference to your memory usage, have positive performance benefits&nbsp;and keep the &quot;<em>Potentially excessive number of SPRequest objects (11) currently unreleased on thread&quot;</em> error messages out of the already huge logs!</p>
<p>Regardless of you language of choice, this <a href="http://msdn2.microsoft.com/en-gb/library/aa973248.aspx">article</a> is definitely worth a read if you are coding for SharePoint!</p>
<p><em>&nbsp;</p>
<p></em></p>
]]></content:encoded>
			<wfw:commentRss>http://vspug.com/aaronrh/2007/11/13/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Best Practice : Using disposable objects in SharePoint</title>
		<link>http://vspug.com/aaronrh/2007/11/13/</link>
		<comments>http://vspug.com/aaronrh/2007/11/13/#comments</comments>
		<pubDate>Tue, 13 Nov 2007 22:59:00 +0000</pubDate>
		<dc:creator>adrh</dc:creator>
		
		<guid isPermaLink="false"></guid>
		<description><![CDATA[I found this article on MSDN via Andrew&#39;s post posing the question &#34;So is it best practice to only use C# for SharePoint development?&#34;. A good question and one that will have plenty of comment from all I imagine. For what it&#39;s worth (although not the point of this post), I&#39;m a fan of C# [...]]]></description>
			<content:encoded><![CDATA[<p>I found <a href="http://msdn2.microsoft.com/en-gb/library/aa973248.aspx">this</a> article on MSDN via Andrew&#39;s <a href="http://www.21apps.com/2007/11/so-is-it-best-practice-to-only-use-c.html">post</a> posing the question &quot;So is it best practice to only use C# for SharePoint development?&quot;. A good question and one that will have plenty of comment from all I imagine. For what it&#39;s worth (although not the point of this post), I&#39;m a fan of C# because I like using (SPSite currentSite=new SPSite(<a href="http://server/">http://Server</a>)) &#8230;</p>
<p>The interesting thing I took from the MSDN article was that objects that are accessed via SPSite objects, like RootWeb and ParentWeb need to be <em>explicitly</em> disposed of when you&#39;re finished with them. I had not appreciated this. I figured that if you &#39;used&#39; <em>using</em> on the SPSite object then that would dispose all the members etc of that object. Not so say our MS friends! <img src="/emoticons/emotion-1.gif" alt="Smile" /></p>
<p>This means:</p>
<p><em>String str;<br /><span style="COLOR:blue;">using</span>(SPSite oSPSite = <span style="COLOR:blue;">new</span> SPSite(<span style="COLOR:maroon;">&quot;http:<span style="COLOR:green;">//server&quot;</span>))</span><br />{<br />&nbsp;&nbsp; str = oSPSite.RootWeb.Title;<br />&nbsp;&nbsp; str = oSPSite.RootWeb.Url;</p>
<p>&nbsp;&nbsp; &#8230; additional processing on RootWeb &#8230; </p>
<p>oSPSite.RootWeb.Dispose();<br />}<br /></em></p>
<p>And, in the interest of fairness:&nbsp;</p>
<p><em>Dim str as string<br />Dim oSPSite as SPSite</em></p>
<p><em>oSPSite=new SPSite(</em><a href="http://server/"><em>http://server</em></a><em>)</em></p>
<p><em>str = oSPSite.RootWeb.Title<br />str = oSPSite.RootWeb.Url</em></p>
<p><em>&#8230; additional processing on RootWeb &#8230; </em></p>
<p><em>oSPSite.RootWeb.Dispose()<br />oSPSite.Dispose()</em></p>
<p>Not really that difficult, but it will make a difference to your memory usage, have positive performance benefits&nbsp;and keep the &quot;<em>Potentially excessive number of SPRequest objects (11) currently unreleased on thread&quot;</em> error messages out of the already huge logs!</p>
<p>Regardless of you language of choice, this <a href="http://msdn2.microsoft.com/en-gb/library/aa973248.aspx">article</a> is definitely worth a read if you are coding for SharePoint!</p>
<p><em>&nbsp;</p>
<p></em></p>
]]></content:encoded>
			<wfw:commentRss>http://vspug.com/aaronrh/2007/11/13/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
