<?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>Sharing The Point &#187; SharePoint</title>
	<atom:link href="http://www.mattjimison.com/blog/category/sharepoint/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mattjimison.com/blog</link>
	<description>A SharePoint Developer's Blog</description>
	<lastBuildDate>Thu, 12 Jan 2012 04:18:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>InfoPath Error: The Control Must Be in the Control Tree of a Page</title>
		<link>http://www.mattjimison.com/blog/2011/10/28/infopath-error-the-control-must-be-in-the-control-tree-of-a-page/</link>
		<comments>http://www.mattjimison.com/blog/2011/10/28/infopath-error-the-control-must-be-in-the-control-tree-of-a-page/#comments</comments>
		<pubDate>Fri, 28 Oct 2011 18:58:54 +0000</pubDate>
		<dc:creator>mjimison</dc:creator>
				<category><![CDATA[InfoPath]]></category>
		<category><![CDATA[SharePoint]]></category>

		<guid isPermaLink="false">http://www.mattjimison.com/blog/?p=236</guid>
		<description><![CDATA[If you are running your SharePoint Server 2010 environment with the latest August 2011 CU, and are using the External Item Picker control in a browser-enabled InfoPath form, you will receive the following message when the form posts back: If you look in your Event Viewer, you will see the following exception: Type: ArgumentException, Exception [...]]]></description>
			<content:encoded><![CDATA[<p>If you are running your SharePoint Server 2010 environment with the latest August 2011 CU, and are using the External Item Picker control in a browser-enabled InfoPath form, you will receive the following message when the form posts back:</p>
<p><img class="alignnone size-full wp-image-237" title="ip-error" src="http://www.mattjimison.com/blog/wp-content/uploads/2011/10/ip-error.gif" alt="" width="446" height="265" /></p>
<p>If you look in your Event Viewer, you will see the following exception:</p>
<blockquote><p>Type: ArgumentException, Exception Message: The control must be in the control tree of a page.<br />
Parameter name: control)</p></blockquote>
<p>This appears to be a regression in the latest CU, but as of yet there is no fix to the problem.</p>
<div style="margin-top:10px; border: 1px solid #333;padding:5px; background: #EFEFEF;">
<strong>Update:</strong> 01/11/2012<br />
I have received new information on this bug that indicates it may be a part of the February 2012 CU.</div>
<div style="margin-top:10px; border: 1px solid #333;padding:5px; background: #EFEFEF;">
<strong>Update:</strong> 11/08/2011<br />
Microsoft has acknowledged the issue as a bug, and are currently working on a hotfix. However, there is currently no date on when that fix will be available.</div>
<div style="margin-top:10px;border: 1px solid #333;padding:5px; background: #EFEFEF;">
<strong>Update:</strong> 10/31/2011<br />
I have applied the October 2011 SharePoint Server 2010 CU, and the problem still exists.
</div>
<h3>Steps to Reproduce</h3>
<ol>
<li>Ensure your SharePoint Server 2010 Environment has SP1 applied</li>
<li>Ensure your SharePoint Server 2010 Environment has August 2011 CU applied</li>
<li>Create a blank InfoPath form</li>
<li>Add a Repeating Table with 1 Column (remove the default column)</li>
<li>Add an External Item Picker to the Repeating Table and Configure General Settings (use the External Content Type details page in Central Admin to find the following information):
<ol>
<li>Set ECT Namespace to the Namespace of External Content Type</li>
<li>Set ECT Name to the Name of External Content Type</li>
<li>Set System Instance Name to External System of External Content Type</li>
</ol>
</li>
<li>Publish the form to a SharePoint Form Library as a browser-enabled form</li>
<li>Launch a new form</li>
<li>Launch the Entity Picker and select a value for the first control in the repeating section</li>
<li>Click &#8216;Add New Item&#8217; to add an additional item (this forces a postback, which is why I chose the repeating table to easily display the issue)</li>
<li>Upon clicking &#8216;Add New Item&#8217; you will receive the error</li>
</ol>
<h3>Workarounds</h3>
<p>At this point the only workaround to this issue is to not upgrade your farm to the latest CU. If you have already done so, however, then I do not currently have a solution that will solve this issue. I will update this post as I get more information.</p>
<p>Cheers,<br />
Matt</p>

<div class="sociable">
<div class="sociable_tagline">
<p><strong>Share this post:</strong></p>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="mailto:?subject=InfoPath%20Error%3A%20The%20Control%20Must%20Be%20in%20the%20Control%20Tree%20of%20a%20Page&amp;body=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2011%2F10%2F28%2Finfopath-error-the-control-must-be-in-the-control-tree-of-a-page%2F" title="email"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=InfoPath%20Error%3A%20The%20Control%20Must%20Be%20in%20the%20Control%20Tree%20of%20a%20Page%20-%20http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2011%2F10%2F28%2Finfopath-error-the-control-must-be-in-the-control-tree-of-a-page%2F" title="Twitter"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2011%2F10%2F28%2Finfopath-error-the-control-must-be-in-the-control-tree-of-a-page%2F&amp;t=InfoPath%20Error%3A%20The%20Control%20Must%20Be%20in%20the%20Control%20Tree%20of%20a%20Page" title="Facebook"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2011%2F10%2F28%2Finfopath-error-the-control-must-be-in-the-control-tree-of-a-page%2F&amp;title=InfoPath%20Error%3A%20The%20Control%20Must%20Be%20in%20the%20Control%20Tree%20of%20a%20Page&amp;notes=If%20you%20are%20running%20your%20SharePoint%20Server%202010%20environment%20with%20the%20latest%20August%202011%20CU%2C%20and%20are%20using%20the%20External%20Item%20Picker%20control%20in%20a%20browser-enabled%20InfoPath%20form%2C%20you%20will%20receive%20the%20following%20message%20when%20the%20form%20posts%20back%3A%0D%0A%0D%0A%0D%0A%0D%0AIf%20y" title="del.icio.us"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2011%2F10%2F28%2Finfopath-error-the-control-must-be-in-the-control-tree-of-a-page%2F&amp;title=InfoPath%20Error%3A%20The%20Control%20Must%20Be%20in%20the%20Control%20Tree%20of%20a%20Page&amp;bodytext=If%20you%20are%20running%20your%20SharePoint%20Server%202010%20environment%20with%20the%20latest%20August%202011%20CU%2C%20and%20are%20using%20the%20External%20Item%20Picker%20control%20in%20a%20browser-enabled%20InfoPath%20form%2C%20you%20will%20receive%20the%20following%20message%20when%20the%20form%20posts%20back%3A%0D%0A%0D%0A%0D%0A%0D%0AIf%20y" title="Digg"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2011%2F10%2F28%2Finfopath-error-the-control-must-be-in-the-control-tree-of-a-page%2F&amp;title=InfoPath%20Error%3A%20The%20Control%20Must%20Be%20in%20the%20Control%20Tree%20of%20a%20Page&amp;annotation=If%20you%20are%20running%20your%20SharePoint%20Server%202010%20environment%20with%20the%20latest%20August%202011%20CU%2C%20and%20are%20using%20the%20External%20Item%20Picker%20control%20in%20a%20browser-enabled%20InfoPath%20form%2C%20you%20will%20receive%20the%20following%20message%20when%20the%20form%20posts%20back%3A%0D%0A%0D%0A%0D%0A%0D%0AIf%20y" title="Google Bookmarks"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2011%2F10%2F28%2Finfopath-error-the-control-must-be-in-the-control-tree-of-a-page%2F&amp;title=InfoPath%20Error%3A%20The%20Control%20Must%20Be%20in%20the%20Control%20Tree%20of%20a%20Page" title="StumbleUpon"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.mattjimison.com/blog/2011/10/28/infopath-error-the-control-must-be-in-the-control-tree-of-a-page/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Content Type Syndication Hub Event Receiver Issues</title>
		<link>http://www.mattjimison.com/blog/2011/09/22/content-type-syndication-hub-event-receiver-issues/</link>
		<comments>http://www.mattjimison.com/blog/2011/09/22/content-type-syndication-hub-event-receiver-issues/#comments</comments>
		<pubDate>Thu, 22 Sep 2011 19:14:08 +0000</pubDate>
		<dc:creator>mjimison</dc:creator>
				<category><![CDATA[Content Type]]></category>
		<category><![CDATA[Event Receiver]]></category>
		<category><![CDATA[SharePoint]]></category>

		<guid isPermaLink="false">http://www.mattjimison.com/blog/?p=211</guid>
		<description><![CDATA[One of the great new features in SharePoint 2010 is the Content Type Syndication Hub, where we can finally achieve global content types. This ability is achieved by creating a site collection that we designate as the hub that pushes content types to web applications that subscribe to it. Along with the content types and [...]]]></description>
			<content:encoded><![CDATA[<p>One of the great new features in SharePoint 2010 is the Content Type Syndication Hub, where we can finally achieve global content types. This ability is achieved by creating a site collection that we designate as the hub that pushes content types to web applications that subscribe to it.</p>
<p>Along with the content types and their related site columns, event receivers also come over during this synchronization process. Attaching event receivers directly to a content type is a good way to ensure your code runs wherever the content type is used.</p>
<h3>The Issue</h3>
<p>I have updated this post to provide detailed instructions on how to reproduce an issue where event receivers in the subscribing site&#8217;s content types appear to be removed when a parent content type that they are based off of, which is in the syndication hub, gets updated with additional event receivers.</p>
<p>Here are the steps to reproduce the issue:</p>
<ol>
<li>Create a content type in the syndication hub, with one or more event receivers attached, and publish it</li>
<li>Create a child content type in a subscribing site based on the content type created in the hub, and add one or more event receivers directly to it (at this point it should have the event receivers from the global content type as well as the new ones added in this step)</li>
<li>Update the parent content type in the hub by adding one or more additional event receivers</li>
<li>Republish the content type in the hub</li>
<li>Once the sync takes place, the child content type no longer has the event receivers that were attached to it, and instead only reflects the event receivers in its parent (I have also found through other configurations where the parent event receivers never make it to the child content type)</li>
</ol>
<div style="border: 1px solid #333;padding:5px; background: #EFEFEF;">
<strong>Update:</strong> 10/31/2011</p>
<p>I have reported the issue to Microsoft, and they have been able to reproduce it, but at this time, I do not have any additional information.</p>
</div>
<h3>The Fix</h3>
<p>The one quick fix to this solution is to reattach any event receivers on your child content types that were removed. However, I am still researching this issue for more information. I will update this post once I have more details.</p>
<p>Cheers,<br />
Matt</p>

<div class="sociable">
<div class="sociable_tagline">
<p><strong>Share this post:</strong></p>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="mailto:?subject=Content%20Type%20Syndication%20Hub%20Event%20Receiver%20Issues&amp;body=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2011%2F09%2F22%2Fcontent-type-syndication-hub-event-receiver-issues%2F" title="email"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Content%20Type%20Syndication%20Hub%20Event%20Receiver%20Issues%20-%20http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2011%2F09%2F22%2Fcontent-type-syndication-hub-event-receiver-issues%2F" title="Twitter"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2011%2F09%2F22%2Fcontent-type-syndication-hub-event-receiver-issues%2F&amp;t=Content%20Type%20Syndication%20Hub%20Event%20Receiver%20Issues" title="Facebook"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2011%2F09%2F22%2Fcontent-type-syndication-hub-event-receiver-issues%2F&amp;title=Content%20Type%20Syndication%20Hub%20Event%20Receiver%20Issues&amp;notes=One%20of%20the%20great%20new%20features%20in%20SharePoint%202010%20is%20the%20Content%20Type%20Syndication%20Hub%2C%20where%20we%20can%20finally%20achieve%20global%20content%20types.%20This%20ability%20is%20achieved%20by%20creating%20a%20site%20collection%20that%20we%20designate%20as%20the%20hub%20that%20pushes%20content%20types%20to%20" title="del.icio.us"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2011%2F09%2F22%2Fcontent-type-syndication-hub-event-receiver-issues%2F&amp;title=Content%20Type%20Syndication%20Hub%20Event%20Receiver%20Issues&amp;bodytext=One%20of%20the%20great%20new%20features%20in%20SharePoint%202010%20is%20the%20Content%20Type%20Syndication%20Hub%2C%20where%20we%20can%20finally%20achieve%20global%20content%20types.%20This%20ability%20is%20achieved%20by%20creating%20a%20site%20collection%20that%20we%20designate%20as%20the%20hub%20that%20pushes%20content%20types%20to%20" title="Digg"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2011%2F09%2F22%2Fcontent-type-syndication-hub-event-receiver-issues%2F&amp;title=Content%20Type%20Syndication%20Hub%20Event%20Receiver%20Issues&amp;annotation=One%20of%20the%20great%20new%20features%20in%20SharePoint%202010%20is%20the%20Content%20Type%20Syndication%20Hub%2C%20where%20we%20can%20finally%20achieve%20global%20content%20types.%20This%20ability%20is%20achieved%20by%20creating%20a%20site%20collection%20that%20we%20designate%20as%20the%20hub%20that%20pushes%20content%20types%20to%20" title="Google Bookmarks"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2011%2F09%2F22%2Fcontent-type-syndication-hub-event-receiver-issues%2F&amp;title=Content%20Type%20Syndication%20Hub%20Event%20Receiver%20Issues" title="StumbleUpon"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.mattjimison.com/blog/2011/09/22/content-type-syndication-hub-event-receiver-issues/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Introduction to Access Services</title>
		<link>http://www.mattjimison.com/blog/2011/09/21/introduction-to-access-services/</link>
		<comments>http://www.mattjimison.com/blog/2011/09/21/introduction-to-access-services/#comments</comments>
		<pubDate>Thu, 22 Sep 2011 03:04:37 +0000</pubDate>
		<dc:creator>mjimison</dc:creator>
				<category><![CDATA[Access Services]]></category>
		<category><![CDATA[Presentation]]></category>
		<category><![CDATA[SharePoint]]></category>

		<guid isPermaLink="false">http://www.mattjimison.com/blog/?p=191</guid>
		<description><![CDATA[I had a great time presenting today at the SharePoint Users of Indiana group. The topic I presented was an Introduction to Access Services, and as promised during the presentation, I am now posting my slides online. Thank you to everyone who came out &#8211; it was great to see such a great turnout from [...]]]></description>
			<content:encoded><![CDATA[<p>I had a great time presenting today at the <a href="http://www.spindiana.com/SitePages/Home.aspx" target="_blank">SharePoint Users of Indiana</a> group. The topic I presented was an Introduction to Access Services, and as promised during the presentation, I am now <a href="http://www.mattjimison.com/blog/wp-content/uploads/2011/09/Access-Services.pdf" target="_blank">posting my slides online</a>.</p>
<p>Thank you to everyone who came out &#8211; it was great to see such a great turnout from the Indianapolis SharePoint community. I definitely encourage anyone who has not yet attended the group to check it out. They meet once a month, alternating between a lunch business presentation, and an evening technical presentation. You can also find additional information on the group at the  <a href="http://www.facebook.com/SPIndiana" target="_blank">SPIndiana Facebook</a> site.</p>
<p>Cheers,</p>
<p>Matt</p>
<h3>Presentation</h3>
<p><a href="http://www.mattjimison.com/blog/wp-content/uploads/2011/09/Access-Services.pdf" target="_blank">View Slides</a></p>
<h3>Questions</h3>
<p>I had some good questions during the presentation, and I will update this posting in the future to provide additional information.</p>

<div class="sociable">
<div class="sociable_tagline">
<p><strong>Share this post:</strong></p>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="mailto:?subject=Introduction%20to%20Access%20Services&amp;body=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2011%2F09%2F21%2Fintroduction-to-access-services%2F" title="email"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Introduction%20to%20Access%20Services%20-%20http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2011%2F09%2F21%2Fintroduction-to-access-services%2F" title="Twitter"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2011%2F09%2F21%2Fintroduction-to-access-services%2F&amp;t=Introduction%20to%20Access%20Services" title="Facebook"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2011%2F09%2F21%2Fintroduction-to-access-services%2F&amp;title=Introduction%20to%20Access%20Services&amp;notes=I%20had%20a%20great%20time%20presenting%20today%20at%20the%20SharePoint%20Users%20of%20Indiana%20group.%20The%20topic%20I%20presented%20was%20an%20Introduction%20to%20Access%20Services%2C%20and%20as%20promised%20during%20the%20presentation%2C%20I%20am%20now%20posting%20my%20slides%20online.%0D%0A%0D%0AThank%20you%20to%20everyone%20who%20came%20" title="del.icio.us"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2011%2F09%2F21%2Fintroduction-to-access-services%2F&amp;title=Introduction%20to%20Access%20Services&amp;bodytext=I%20had%20a%20great%20time%20presenting%20today%20at%20the%20SharePoint%20Users%20of%20Indiana%20group.%20The%20topic%20I%20presented%20was%20an%20Introduction%20to%20Access%20Services%2C%20and%20as%20promised%20during%20the%20presentation%2C%20I%20am%20now%20posting%20my%20slides%20online.%0D%0A%0D%0AThank%20you%20to%20everyone%20who%20came%20" title="Digg"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2011%2F09%2F21%2Fintroduction-to-access-services%2F&amp;title=Introduction%20to%20Access%20Services&amp;annotation=I%20had%20a%20great%20time%20presenting%20today%20at%20the%20SharePoint%20Users%20of%20Indiana%20group.%20The%20topic%20I%20presented%20was%20an%20Introduction%20to%20Access%20Services%2C%20and%20as%20promised%20during%20the%20presentation%2C%20I%20am%20now%20posting%20my%20slides%20online.%0D%0A%0D%0AThank%20you%20to%20everyone%20who%20came%20" title="Google Bookmarks"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2011%2F09%2F21%2Fintroduction-to-access-services%2F&amp;title=Introduction%20to%20Access%20Services" title="StumbleUpon"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.mattjimison.com/blog/2011/09/21/introduction-to-access-services/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SharePoint Saturday, Columbus: jQuery Rescue Adventure Presentation</title>
		<link>http://www.mattjimison.com/blog/2011/08/20/sharepoint-saturday-columbus-jquery-rescue-adventure-presentation/</link>
		<comments>http://www.mattjimison.com/blog/2011/08/20/sharepoint-saturday-columbus-jquery-rescue-adventure-presentation/#comments</comments>
		<pubDate>Sun, 21 Aug 2011 01:09:04 +0000</pubDate>
		<dc:creator>mjimison</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Presentation]]></category>
		<category><![CDATA[SharePoint]]></category>

		<guid isPermaLink="false">http://www.mattjimison.com/blog/?p=177</guid>
		<description><![CDATA[I just arrived home from my trip to Columbus, Ohio today for SharePoint Saturday. I really enjoyed being able to give this presentation to a great audience, so thank you all for your time and attention. As promised, I am now providing my slide deck and code online. I will elaborate on some of the [...]]]></description>
			<content:encoded><![CDATA[<p>I just arrived home from my trip to Columbus, Ohio today for SharePoint Saturday. I really enjoyed being able to give this presentation to a great audience, so thank you all for your time and attention. As promised, I am now providing my slide deck and code online. I will elaborate on some of the examples we went over in more detail on future posts, but I have provided a text file with the snippets of JavaScript used to do things today such as setting all external links to open in a new browser, as well as creating the sliding descriptions on the SharePoint Saturday website. I hope you all enjoy.</p>
<h2>Presentation Files</h2>
<ul>
<li><a href="http://www.mattjimison.com/blog/wp-content/uploads/2011/08/jQuery-Rescue-Adventure.pdf" target="_blank">Slide Deck</a></li>
<li><a href="http://www.mattjimison.com/blog/wp-content/uploads/2011/08/jQuery-Example-Code.txt" target="_blank">Code Snippets</a></li>
</ul>
<h2>Presentation Resources</h2>
<p style="font-size: 0.9em;">(Note: Additional Resources are included in the presentation)</p>
<ul>
<li><a href="http://jquery.com" target="_blank">jQuery</a></li>
<li><a href="http://jquery-howto.blogspot.com/2009/06/find-select-all-external-links-with.html" target="_blank">jQuery External Selector</a></li>
<li><a href="http://www.learningjquery.com/2009/04/better-stronger-safer-jquerify-bookmarklet" target="_blank">jQuerify Bookmark</a></li>
<li><a href="http://www.slidedeck.com" target="_blank">SlideDeck</a></li>
</ul>

<div class="sociable">
<div class="sociable_tagline">
<p><strong>Share this post:</strong></p>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="mailto:?subject=SharePoint%20Saturday%2C%20Columbus%3A%20jQuery%20Rescue%20Adventure%20Presentation&amp;body=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2011%2F08%2F20%2Fsharepoint-saturday-columbus-jquery-rescue-adventure-presentation%2F" title="email"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=SharePoint%20Saturday%2C%20Columbus%3A%20jQuery%20Rescue%20Adventure%20Presentation%20-%20http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2011%2F08%2F20%2Fsharepoint-saturday-columbus-jquery-rescue-adventure-presentation%2F" title="Twitter"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2011%2F08%2F20%2Fsharepoint-saturday-columbus-jquery-rescue-adventure-presentation%2F&amp;t=SharePoint%20Saturday%2C%20Columbus%3A%20jQuery%20Rescue%20Adventure%20Presentation" title="Facebook"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2011%2F08%2F20%2Fsharepoint-saturday-columbus-jquery-rescue-adventure-presentation%2F&amp;title=SharePoint%20Saturday%2C%20Columbus%3A%20jQuery%20Rescue%20Adventure%20Presentation&amp;notes=I%20just%20arrived%20home%20from%20my%20trip%20to%20Columbus%2C%20Ohio%20today%20for%20SharePoint%20Saturday.%20I%20really%20enjoyed%20being%20able%20to%20give%20this%20presentation%20to%20a%20great%20audience%2C%20so%20thank%20you%20all%20for%20your%20time%20and%20attention.%20As%20promised%2C%20I%20am%20now%20providing%20my%20slide%20deck%20a" title="del.icio.us"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2011%2F08%2F20%2Fsharepoint-saturday-columbus-jquery-rescue-adventure-presentation%2F&amp;title=SharePoint%20Saturday%2C%20Columbus%3A%20jQuery%20Rescue%20Adventure%20Presentation&amp;bodytext=I%20just%20arrived%20home%20from%20my%20trip%20to%20Columbus%2C%20Ohio%20today%20for%20SharePoint%20Saturday.%20I%20really%20enjoyed%20being%20able%20to%20give%20this%20presentation%20to%20a%20great%20audience%2C%20so%20thank%20you%20all%20for%20your%20time%20and%20attention.%20As%20promised%2C%20I%20am%20now%20providing%20my%20slide%20deck%20a" title="Digg"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2011%2F08%2F20%2Fsharepoint-saturday-columbus-jquery-rescue-adventure-presentation%2F&amp;title=SharePoint%20Saturday%2C%20Columbus%3A%20jQuery%20Rescue%20Adventure%20Presentation&amp;annotation=I%20just%20arrived%20home%20from%20my%20trip%20to%20Columbus%2C%20Ohio%20today%20for%20SharePoint%20Saturday.%20I%20really%20enjoyed%20being%20able%20to%20give%20this%20presentation%20to%20a%20great%20audience%2C%20so%20thank%20you%20all%20for%20your%20time%20and%20attention.%20As%20promised%2C%20I%20am%20now%20providing%20my%20slide%20deck%20a" title="Google Bookmarks"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2011%2F08%2F20%2Fsharepoint-saturday-columbus-jquery-rescue-adventure-presentation%2F&amp;title=SharePoint%20Saturday%2C%20Columbus%3A%20jQuery%20Rescue%20Adventure%20Presentation" title="StumbleUpon"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.mattjimison.com/blog/2011/08/20/sharepoint-saturday-columbus-jquery-rescue-adventure-presentation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Duplicate Content Type Found Error</title>
		<link>http://www.mattjimison.com/blog/2011/06/21/a-duplicate-content-type-found-error/</link>
		<comments>http://www.mattjimison.com/blog/2011/06/21/a-duplicate-content-type-found-error/#comments</comments>
		<pubDate>Wed, 22 Jun 2011 03:07:23 +0000</pubDate>
		<dc:creator>mjimison</dc:creator>
				<category><![CDATA[2010]]></category>
		<category><![CDATA[Content Type]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SharePoint]]></category>

		<guid isPermaLink="false">http://www.mattjimison.com/blog/?p=145</guid>
		<description><![CDATA[A duplicate content type &#8220;Enter Name&#8221; was found If you&#8217;ve gotten this error and come to this site looking for answers, chances are it isn&#8217;t simply because the name you&#8217;re trying to give a new content type is already in use. On the contrary, you are probably sitting there saying that you know without a [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>A duplicate content type &#8220;Enter Name&#8221; was found</p></blockquote>
<p>If you&#8217;ve gotten this error and come to this site looking for answers, chances are it isn&#8217;t simply because the name you&#8217;re trying to give a new content type is already in use. On the contrary, you are probably sitting there saying that you <em>know without a doubt</em> the name you are entering is not in use, and you have probably even pounded a random value out on your keyboard just to prove the point.</p>
<p>Maybe you&#8217;ve come across forum posts like the following that suggest you make an update directly to the content database (<a href="http://social.msdn.microsoft.com/Forums/en-US/sharepoint2010general/thread/5e30ade2-93b0-4f5c-8acd-25b73946500c/" target="_blank">MSDN Forum Post</a>). I never go this route, because it is going to take you out of support with Microsoft, since working with the database is specifically prohibited.</p>
<p>I have, however, created a way to overcome this error utilizing perfectly legal methods.</p>
<h3>What Does This Error Mean?</h3>
<p>There are 2 ways to create an ID for a content type (<a href="http://msdn.microsoft.com/en-us/library/aa543822.aspx" target="_blank">MSDN Site</a>). One involves assigning a child id based off a numerical sequence, and the other involves utilizing a unique guid. If you are developing your own content types, I highly recommend always creating your id&#8217;s with the unique method because you don&#8217;t risk conflicting with another developer or a 3rd party solution, but if you are creating content types through the UI, you have no choice &#8211; the UI method always creates children id&#8217;s based off of a numerical sequence (until it runs out of numerical values).</p>
</p>
<p> Another new feature in SharePoint 2010 also seems to add to this problem, as when utilizing a Content Type Hub, you essentially end up with 2 different sources (the hub and the site) trying to issue children content types and keep track of what the next numerical id should be. The content database has a field on the dbo.ContentTypes table called &#8220;NextChildByte&#8221; and that is what lets SharePoint know what that next numerical value should be. This is the heart of our problem. Sometimes SharePoint gets out of sync with itself, and &#8220;NextChildByte&#8221; indicates a value that already is in use. SharePoint is not intelligent enough to continue looking sequentially until it finds the next available byte sequence. Instead, it throws the error you see at the top of the page. That is why the posts online about updating this value in the database work &#8211; because the heart of the problem is this value, which is incorrectly telling SharePoint what the next numerical value for a child of this content type should be.</p>
<h3>The Solution</h3>
<p>I looked at this solution from a few perspectives, but ultimately knew I needed to get this &#8220;NextChildByte&#8221; value to change without issuing a command on the database. I discovered through testing that every time a content type is created programmatically (where you set the ID &#8211; either in the numerical format <b>OR</b> the unique guid format) this value gets incremented by 1. This is an increment of 1 each time &#8211; it doesn&#8217;t recalculate this value based on the content types already in the site. Essentially what we need to do is create enough &#8220;dummy&#8221; content types to increment this value up to a point where those numerical values have not yet been used in other content types.</p>
<p> I&#8217;ve written a PowerShell function that takes in an SPWeb and SPContentType that you are having trouble creating child content types of through the UI, and it simply adds 10 &#8220;dummy&#8221; child content types with random id&#8217;s and then removes them (thereby also freeing the random id&#8217;s it added). This ends up incrementing &#8220;NextChildByte&#8221; in the database by 10 and fixing your issue. If incrementing by 10 isn&#8217;t enough for you, or you run into the problem again down the road, you can update the script to suit your needs and re-run it. You may be wondering what happens after you reach the end of the numerical range expressed by a hexadecimal value (FF). At the point you run off the track (which would seem unlikely) SharePoint is intelligent enough to just create the children with Unique ID&#8217;s after that point. &#8220;NextChildByte&#8221; in the database then sits at 0, even as you add more content types.</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #0000FF;">function</span> FixContentTypeForChildCreation
<span style="color: #000000;">&#123;</span>
    <span style="color: #0000FF;">param</span><span style="color: #000000;">&#40;</span>
    <span style="color: #000000;">&#91;</span><span style="color: #008080;">Microsoft.SharePoint.SPWeb</span><span style="color: #000000;">&#93;</span><span style="color: #800080;">$web</span><span style="color: pink;">,</span>
    <span style="color: #000000;">&#91;</span>Microsoft.SharePoint.SPContentType<span style="color: #000000;">&#93;</span><span style="color: #800080;">$ct</span>
    <span style="color: #000000;">&#41;</span>
&nbsp;
    <span style="color: #008000;">#Grab the ID of the CT you need to fix for child creation</span>
    <span style="color: #800080;">$ctID</span> <span style="color: pink;">=</span> <span style="color: #800080;">$ct</span>.ID.ToString<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
    <span style="color: #0000FF;">for</span><span style="color: #000000;">&#40;</span><span style="color: #800080;">$i</span><span style="color: pink;">=</span><span style="color: #804000;">0</span>;$i <span style="color: #FF0000;">-lt</span> <span style="color: #804000;">10</span>; <span style="color: #800080;">$i</span><span style="color: pink;">++</span><span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
        <span style="color: #008000;">#Create a new child content type with a unique guid and then delete it</span>
        <span style="color: #800080;">$newCTID</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">new-object</span> Microsoft.SharePoint.SPContentTypeId<span style="color: #000000;">&#40;</span><span style="color: #800080;">$ctID</span> <span style="color: pink;">+</span> <span style="color: #800000;">&quot;00&quot;</span> <span style="color: pink;">+</span> <span style="color: #000000;">&#91;</span>Guid<span style="color: #000000;">&#93;</span>::NewGuid<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.ToString<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;n&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;
        <span style="color: #800080;">$newCT</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">new-object</span> Microsoft.SharePoint.SPContentType<span style="color: #000000;">&#40;</span><span style="color: #800080;">$newCTID</span><span style="color: pink;">,</span> <span style="color: #800080;">$web</span>.ContentTypes<span style="color: pink;">,</span> <span style="color: #800000;">&quot;Temp Content Type - Auto Deleted&quot;</span><span style="color: #000000;">&#41;</span>;
        <span style="color: #800080;">$addedCT</span> <span style="color: pink;">=</span> <span style="color: #800080;">$web</span>.ContentTypes.Add<span style="color: #000000;">&#40;</span><span style="color: #800080;">$newCT</span><span style="color: #000000;">&#41;</span>;
        <span style="color: #800080;">$newCT</span>.Delete<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;    
    <span style="color: #000000;">&#125;</span>
&nbsp;
    <span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #800000;">&quot;Content Type Fix for Child Creation is Complete&quot;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<h3>Example Usage</h3>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #800080;">$web</span> <span style="color: pink;">=</span> get<span style="color: pink;">-</span>spweb <span style="color: #800000;">&quot;http://yoursite&quot;</span>
<span style="color: #800080;">$ct</span> <span style="color: pink;">=</span> <span style="color: #800080;">$web</span>.AvailableContentTypes<span style="color: #000000;">&#91;</span><span style="color: #800000;">&quot;YourContentType&quot;</span><span style="color: #000000;">&#93;</span>
FixContentTypeForChildCreation <span style="color: #800080;">$web</span> $ct</pre></div></div>

<p>I hope that this solution is able to help you through what can certainly be a frustrating time for users who are unable to create content types in the UI.</p>
<p>Cheers,<br />
Matt</p>

<div class="sociable">
<div class="sociable_tagline">
<p><strong>Share this post:</strong></p>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="mailto:?subject=A%20Duplicate%20Content%20Type%20Found%20Error&amp;body=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2011%2F06%2F21%2Fa-duplicate-content-type-found-error%2F" title="email"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=A%20Duplicate%20Content%20Type%20Found%20Error%20-%20http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2011%2F06%2F21%2Fa-duplicate-content-type-found-error%2F" title="Twitter"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2011%2F06%2F21%2Fa-duplicate-content-type-found-error%2F&amp;t=A%20Duplicate%20Content%20Type%20Found%20Error" title="Facebook"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2011%2F06%2F21%2Fa-duplicate-content-type-found-error%2F&amp;title=A%20Duplicate%20Content%20Type%20Found%20Error&amp;notes=A%20duplicate%20content%20type%20%22Enter%20Name%22%20was%20found%0D%0AIf%20you%27ve%20gotten%20this%20error%20and%20come%20to%20this%20site%20looking%20for%20answers%2C%20chances%20are%20it%20isn%27t%20simply%20because%20the%20name%20you%27re%20trying%20to%20give%20a%20new%20content%20type%20is%20already%20in%20use.%20On%20the%20contrary%2C%20you%20are%20" title="del.icio.us"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2011%2F06%2F21%2Fa-duplicate-content-type-found-error%2F&amp;title=A%20Duplicate%20Content%20Type%20Found%20Error&amp;bodytext=A%20duplicate%20content%20type%20%22Enter%20Name%22%20was%20found%0D%0AIf%20you%27ve%20gotten%20this%20error%20and%20come%20to%20this%20site%20looking%20for%20answers%2C%20chances%20are%20it%20isn%27t%20simply%20because%20the%20name%20you%27re%20trying%20to%20give%20a%20new%20content%20type%20is%20already%20in%20use.%20On%20the%20contrary%2C%20you%20are%20" title="Digg"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2011%2F06%2F21%2Fa-duplicate-content-type-found-error%2F&amp;title=A%20Duplicate%20Content%20Type%20Found%20Error&amp;annotation=A%20duplicate%20content%20type%20%22Enter%20Name%22%20was%20found%0D%0AIf%20you%27ve%20gotten%20this%20error%20and%20come%20to%20this%20site%20looking%20for%20answers%2C%20chances%20are%20it%20isn%27t%20simply%20because%20the%20name%20you%27re%20trying%20to%20give%20a%20new%20content%20type%20is%20already%20in%20use.%20On%20the%20contrary%2C%20you%20are%20" title="Google Bookmarks"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2011%2F06%2F21%2Fa-duplicate-content-type-found-error%2F&amp;title=A%20Duplicate%20Content%20Type%20Found%20Error" title="StumbleUpon"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.mattjimison.com/blog/2011/06/21/a-duplicate-content-type-found-error/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Disable Event Receivers During an Update</title>
		<link>http://www.mattjimison.com/blog/2011/05/11/disable-event-receivers-during-an-update/</link>
		<comments>http://www.mattjimison.com/blog/2011/05/11/disable-event-receivers-during-an-update/#comments</comments>
		<pubDate>Thu, 12 May 2011 03:18:16 +0000</pubDate>
		<dc:creator>mjimison</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Event Receiver]]></category>
		<category><![CDATA[SharePoint]]></category>

		<guid isPermaLink="false">http://www.mattjimison.com/blog/?p=122</guid>
		<description><![CDATA[There comes a time in developing SharePoint solutions where you may find yourself asking: This is not the time I want my event receiver to run This is not the place where I can set EventFiringEnabled = false This is not the way I want this call to SystemUpdate() to behave You&#8217;ve probably developed an [...]]]></description>
			<content:encoded><![CDATA[<p>There comes a time in developing SharePoint solutions where you may find yourself asking:</p>
<blockquote><p>
<em>This is not the time I want my event receiver to run</em><br />
<em>This is not the place where I can set EventFiringEnabled = false</em><br />
<em>This is not the way I want this call to SystemUpdate() to behave</em>
</p></blockquote>
<p>You&#8217;ve probably developed an event receiver before that updated something, and you used EventFiringEnabled to keep the receiver from recursively calling itself (or its 2007 method equivalent). However, have you ever encountered a time where you were programmatically updating something in a Workflow, in PowerShell, etc&#8230; and you noticed that when calling SystemUpdate() your event receivers still fired, and this caused you an issue? The good news is that there is a way to get around this. It relies on utilizing EventFiringEnabled.</p>
<p>The summary of how EventFiringEnabled works is that it is a thread-specific setting that effects <strong>any</strong> items being updated. We just need to do 2 things:</p>
<ol>
<li>Create an event receiver that just has methods for disabling and enabling event firings (you don&#8217;t need to override a single method)</li>
<li>Create some code where we instantiate a new instance of this event receiver, and execute your code in between calling your Disable and Enable methods on the event receiver instance</li>
</ol>
<p>I like to take this a little further and create a delegate that I can pass into a utility function that allows me just to pass some code into a method, and I know that it gets executed without events firing. This is the same pattern that SPSecurity.RunWithElevatedPrivileges uses, and it&#8217;s helpful. </p>
<p>Here&#8217;s the code to help you make this happen:</p>
<h3>Event Receiver Code</h3>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> SPRunWithoutEventsFiringEventReceiver <span style="color: #008000;">:</span> SPItemEventReceiver
  <span style="color: #008000;">&#123;</span>
    <span style="color: #008080;">#region Methods</span>
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">void</span> DisableEvents<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
      <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">EventFiringEnabled</span> <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">false</span><span style="color: #008000;">;</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">void</span> EnableEvents<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
      <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">EventFiringEnabled</span> <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">;</span>
    <span style="color: #008000;">&#125;</span>
    <span style="color: #008080;">#endregion</span>
  <span style="color: #008000;">&#125;</span></pre></div></div>

<h3>Utility Method</h3>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">class</span> SPUtilities
  <span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">delegate</span> <span style="color: #6666cc; font-weight: bold;">void</span> RunWithoutEventsFiringDelegate<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">void</span> RunWithoutEventsFiring<span style="color: #008000;">&#40;</span>RunWithoutEventsFiringDelegate code<span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
      SPRunWithoutEventsFiringEventReceiver eventReceiver <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> SPRunWithoutEventsFiringEventReceiver<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
      <span style="color: #0600FF; font-weight: bold;">try</span>
      <span style="color: #008000;">&#123;</span>
        eventReceiver<span style="color: #008000;">.</span><span style="color: #0000FF;">DisableEvents</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        code<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
      <span style="color: #008000;">&#125;</span>
      <span style="color: #0600FF; font-weight: bold;">finally</span>
      <span style="color: #008000;">&#123;</span>
        eventReceiver<span style="color: #008000;">.</span><span style="color: #0000FF;">EnableEvents</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
      <span style="color: #008000;">&#125;</span>
    <span style="color: #008000;">&#125;</span>
  <span style="color: #008000;">&#125;</span></pre></div></div>

<h3>Example Usage</h3>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">SPUtilities<span style="color: #008000;">.</span><span style="color: #0000FF;">RunWithoutEventsFiring</span><span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">delegate</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
      <span style="color: #008000;">&#123;</span>
        item<span style="color: #008000;">&#91;</span><span style="color: #666666;">&quot;Title&quot;</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;New Update&quot;</span><span style="color: #008000;">;</span>
        item<span style="color: #008000;">.</span><span style="color: #0000FF;">SystemUpdate</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">false</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
      <span style="color: #008000;">&#125;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p>I hope that you found the article helpful, and that this comes in handy on one of your future projects!</p>
<p>Cheers,<br />
Matt</p>

<div class="sociable">
<div class="sociable_tagline">
<p><strong>Share this post:</strong></p>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="mailto:?subject=Disable%20Event%20Receivers%20During%20an%20Update&amp;body=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2011%2F05%2F11%2Fdisable-event-receivers-during-an-update%2F" title="email"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Disable%20Event%20Receivers%20During%20an%20Update%20-%20http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2011%2F05%2F11%2Fdisable-event-receivers-during-an-update%2F" title="Twitter"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2011%2F05%2F11%2Fdisable-event-receivers-during-an-update%2F&amp;t=Disable%20Event%20Receivers%20During%20an%20Update" title="Facebook"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2011%2F05%2F11%2Fdisable-event-receivers-during-an-update%2F&amp;title=Disable%20Event%20Receivers%20During%20an%20Update&amp;notes=There%20comes%20a%20time%20in%20developing%20SharePoint%20solutions%20where%20you%20may%20find%20yourself%20asking%3A%0D%0A%0D%0A%0D%0AThis%20is%20not%20the%20time%20I%20want%20my%20event%20receiver%20to%20run%0D%0AThis%20is%20not%20the%20place%20where%20I%20can%20set%20EventFiringEnabled%20%3D%20false%0D%0AThis%20is%20not%20the%20way%20I%20want%20this%20cal" title="del.icio.us"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2011%2F05%2F11%2Fdisable-event-receivers-during-an-update%2F&amp;title=Disable%20Event%20Receivers%20During%20an%20Update&amp;bodytext=There%20comes%20a%20time%20in%20developing%20SharePoint%20solutions%20where%20you%20may%20find%20yourself%20asking%3A%0D%0A%0D%0A%0D%0AThis%20is%20not%20the%20time%20I%20want%20my%20event%20receiver%20to%20run%0D%0AThis%20is%20not%20the%20place%20where%20I%20can%20set%20EventFiringEnabled%20%3D%20false%0D%0AThis%20is%20not%20the%20way%20I%20want%20this%20cal" title="Digg"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2011%2F05%2F11%2Fdisable-event-receivers-during-an-update%2F&amp;title=Disable%20Event%20Receivers%20During%20an%20Update&amp;annotation=There%20comes%20a%20time%20in%20developing%20SharePoint%20solutions%20where%20you%20may%20find%20yourself%20asking%3A%0D%0A%0D%0A%0D%0AThis%20is%20not%20the%20time%20I%20want%20my%20event%20receiver%20to%20run%0D%0AThis%20is%20not%20the%20place%20where%20I%20can%20set%20EventFiringEnabled%20%3D%20false%0D%0AThis%20is%20not%20the%20way%20I%20want%20this%20cal" title="Google Bookmarks"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2011%2F05%2F11%2Fdisable-event-receivers-during-an-update%2F&amp;title=Disable%20Event%20Receivers%20During%20an%20Update" title="StumbleUpon"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.mattjimison.com/blog/2011/05/11/disable-event-receivers-during-an-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>All You Can Eat GUIDs with PowerShell</title>
		<link>http://www.mattjimison.com/blog/2010/11/29/all-you-can-eat-guids-with-powershell/</link>
		<comments>http://www.mattjimison.com/blog/2010/11/29/all-you-can-eat-guids-with-powershell/#comments</comments>
		<pubDate>Tue, 30 Nov 2010 02:13:52 +0000</pubDate>
		<dc:creator>mjimison</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SharePoint]]></category>

		<guid isPermaLink="false">http://www.mattjimison.com/blog/?p=104</guid>
		<description><![CDATA[With the recent Thanksgiving Holiday, I thought it would be a good time to share a trick that will provide a feast of GUIDS. I like to use this method while doing SharePoint development, but it can really be useful anytime you have a need to create several GUIDs. While it is easy to create [...]]]></description>
			<content:encoded><![CDATA[<p>With the recent Thanksgiving Holiday, I thought it would be a good time to share a trick that will provide a feast of GUIDS. I like to use this method while doing SharePoint development, but it can really be useful anytime you have a need to create several GUIDs. While it is easy to create a random GUID through the GUID Generator packaged with Visual Studio, or do so through code, I often find myself needing to create many GUIDs at once, so I created this trick to keep a fresh slab of GUIDs at the ready for when the time calls.</p>
<p>This is a PowerShell script that will allow you to create a multitude of GUIDs and save them to a file for later use. It is a quick one-liner, although I have divided it into multiple lines here for readability. I like to simply remove GUIDs from the top as I use them, to ensure I don&#8217;t duplicate one throughout my development.</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: pink;">@</span><span style="color: #000000;">&#40;</span><span style="color: #0000FF;">for</span><span style="color: #000000;">&#40;</span><span style="color: #800080;">$i</span><span style="color: pink;">=</span><span style="color: #804000;">0</span>; <span style="color: #800080;">$i</span> <span style="color: #FF0000;">-lt</span> <span style="color: #804000;">100</span>; <span style="color: #800080;">$i</span><span style="color: pink;">++</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span> 
<span style="color: #000000;">&#91;</span>System.Guid<span style="color: #000000;">&#93;</span>::NewGuid<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.ToString<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;B&quot;</span><span style="color: #000000;">&#41;</span> 
<span style="color: #000000;">&#125;</span><span style="color: #000000;">&#41;</span> <span style="color: pink;">&gt;</span> <span style="color: #800000;">&quot;C:\Guids.txt&quot;</span></pre></div></div>

<p>
When outputting the GUIDs, you may need a specific format. Here is a helpful list: (Source: <a href="http://msdn.microsoft.com/en-us/library/97af8hh4.aspx" target="_blank">http://msdn.microsoft.com/en-us/library/97af8hh4.aspx</a>)</p>
<table border="0" cellspacing="0" cellpadding="3" width="100%" style="margin-bottom: 15px;">
<tbody>
<tr style="background: #C7C7C7;">
<td><strong>Format</strong></td>
<td><strong>Output</strong></td>
</tr>
<tr valign="top">
<td width="20%"><strong>(Empty)</strong></td>
<td width="80%">00000000-0000-0000-0000-000000000000</td>
</tr>
<tr valign="top">
<td><strong>N</strong></td>
<td>00000000000000000000000000000000</td>
</tr>
<tr valign="top">
<td><strong>D</strong></td>
<td>00000000-0000-0000-0000-000000000000</td>
</tr>
<tr valign="top">
<td><strong>B</strong></td>
<td>{00000000-0000-0000-0000-000000000000}</td>
</tr>
<tr valign="top">
<td><strong>P</strong></td>
<td>(00000000-0000-0000-0000-000000000000)</td>
</tr>
<tr valign="top">
<td><strong>X</strong></td>
<td>{0&#215;00000000,0&#215;0000,0&#215;0000,{0&#215;00,0&#215;00,0&#215;00,0&#215;00,0&#215;00,0&#215;00,0&#215;00,0&#215;00}</td>
</tr>
</tbody>
</table>
<p>I hope this is helpful. Cheers!</p>

<div class="sociable">
<div class="sociable_tagline">
<p><strong>Share this post:</strong></p>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="mailto:?subject=All%20You%20Can%20Eat%20GUIDs%20with%20PowerShell&amp;body=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2010%2F11%2F29%2Fall-you-can-eat-guids-with-powershell%2F" title="email"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=All%20You%20Can%20Eat%20GUIDs%20with%20PowerShell%20-%20http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2010%2F11%2F29%2Fall-you-can-eat-guids-with-powershell%2F" title="Twitter"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2010%2F11%2F29%2Fall-you-can-eat-guids-with-powershell%2F&amp;t=All%20You%20Can%20Eat%20GUIDs%20with%20PowerShell" title="Facebook"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2010%2F11%2F29%2Fall-you-can-eat-guids-with-powershell%2F&amp;title=All%20You%20Can%20Eat%20GUIDs%20with%20PowerShell&amp;notes=With%20the%20recent%20Thanksgiving%20Holiday%2C%20I%20thought%20it%20would%20be%20a%20good%20time%20to%20share%20a%20trick%20that%20will%20provide%20a%20feast%20of%20GUIDS.%20I%20like%20to%20use%20this%20method%20while%20doing%20SharePoint%20development%2C%20but%20it%20can%20really%20be%20useful%20anytime%20you%20have%20a%20need%20to%20create%20s" title="del.icio.us"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2010%2F11%2F29%2Fall-you-can-eat-guids-with-powershell%2F&amp;title=All%20You%20Can%20Eat%20GUIDs%20with%20PowerShell&amp;bodytext=With%20the%20recent%20Thanksgiving%20Holiday%2C%20I%20thought%20it%20would%20be%20a%20good%20time%20to%20share%20a%20trick%20that%20will%20provide%20a%20feast%20of%20GUIDS.%20I%20like%20to%20use%20this%20method%20while%20doing%20SharePoint%20development%2C%20but%20it%20can%20really%20be%20useful%20anytime%20you%20have%20a%20need%20to%20create%20s" title="Digg"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2010%2F11%2F29%2Fall-you-can-eat-guids-with-powershell%2F&amp;title=All%20You%20Can%20Eat%20GUIDs%20with%20PowerShell&amp;annotation=With%20the%20recent%20Thanksgiving%20Holiday%2C%20I%20thought%20it%20would%20be%20a%20good%20time%20to%20share%20a%20trick%20that%20will%20provide%20a%20feast%20of%20GUIDS.%20I%20like%20to%20use%20this%20method%20while%20doing%20SharePoint%20development%2C%20but%20it%20can%20really%20be%20useful%20anytime%20you%20have%20a%20need%20to%20create%20s" title="Google Bookmarks"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2010%2F11%2F29%2Fall-you-can-eat-guids-with-powershell%2F&amp;title=All%20You%20Can%20Eat%20GUIDs%20with%20PowerShell" title="StumbleUpon"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.mattjimison.com/blog/2010/11/29/all-you-can-eat-guids-with-powershell/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SharePoint 2010 WebPart Enhancements</title>
		<link>http://www.mattjimison.com/blog/2009/10/23/sharepoint-2010-webpart-enhancements/</link>
		<comments>http://www.mattjimison.com/blog/2009/10/23/sharepoint-2010-webpart-enhancements/#comments</comments>
		<pubDate>Fri, 23 Oct 2009 19:54:44 +0000</pubDate>
		<dc:creator>mjimison</dc:creator>
				<category><![CDATA[2010]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[WebPart]]></category>

		<guid isPermaLink="false">http://www.mattjimison.com/blog/?p=85</guid>
		<description><![CDATA[It&#8217;s been too long since my last post. I struggle as a blogger because I feel my time is better spent reading bloggers like Andrew Connell, Waldek Mastykarz, Eric Shupps, and so on, rather than writing my own content. I never imagined this long of a gap between my last posts, but the recent SharePoint [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been too long since my last post. I struggle as a blogger because I feel my time is better spent reading bloggers like <a href="http://www.andrewconnell.com/blog/Default.aspx" target="_blank">Andrew Connell</a>, <a href="http://blog.mastykarz.nl/" target="_blank">Waldek Mastykarz</a>, <a href="http://www.binarywave.com/blogs/eshupps/default.aspx" target="_blank">Eric Shupps</a>, and so on, rather than writing my own content. I never imagined this long of a gap between my last posts, but the recent SharePoint conference has re-inspired me to begin writing again.</p>
<p>I was one of the lucky few who was registered and set to hit Vegas for the 2009 SharePoint conference. However, as luck would have it, the H1N1 virus had other plans for me, and I was forced to stay at home and watch all of the conference online. Although I missed out on a lot of the fun, I was able to soak in a lot of the information, and so I want to summarize some of the new features for anyone who wasn&#8217;t able to attend, or didn&#8217;t get to all of the sessions they had hope to watch.</p>
<p>Most of the content in this post came from a great session on Advanced WebPart development, which was done by Maurice Prather, from <a href="http://www.sharesquared.com/Pages/default.aspx" target="_blank">ShareSquared</a>. Here are the main points I&#8217;d like to highlight:</p>
<h2>Versioning</h2>
<p>Anyone who has had an author put a lot of content into a Content Editor WebPart, and ask the question &#8220;Why is my content not changing when I restore a version?&#8221; is going to be happy about this addition. WebParts are now versioned with pages, so you no longer are only left with the option of putting your content into the publishing content fields. There are a lot of  strong opinions out there saying the content editor WebPart shouldn&#8217;t even be used, but if you&#8217;re in an organization who has decided to continue using it, being able to version that data will be a big help. It will also be nice for keeping configuration setups for other WebParts such as the content query WebPart, where you&#8217;ve gone through revisions and want to roll back to earlier settings.</p>
<h2>Visual WebParts</h2>
<p>This is really not something new to SharePoint 2010. What&#8217;s new is Visual Studio&#8217;s excellent automation of a system many have been using for a long time. ASP.Net developers are often more comfortable when working within a designer GUI where controls can be dragged and dropped. While using CreateChildControls is perfectly valid, and still a good way to go, creating an experience where less code is written often leads to more productivity. The trick has always been the following:</p>
<ol>
<li>Create a User Control within Visual Studio</li>
<li>Push the User Control into the ControlTemplates directory inside the 12 Hive (located at: 12 Hive/Templates/ControlTemplates)</li>
<li>Create a WebPart class and use Page.LoadControl inside CreateChildControls to load in your User Control</li>
</ol>
<p>This same concept is exactly what Visual Studio is now doing for you, but its taking out many of the steps you would perform manually, and making it a much more complete experience.<br />
(Note: Visual WebParts will not work when part of a Sandboxed Solution, something i plan to recap in another post)</p>
<h2>Cross-Site Scripting Safeguards (XSS)</h2>
<p>This affects old and new WebParts, and it&#8217;s important to understand how your current solutions could be affected, even if they will still otherwise work in SharePoint 2010. Simple properties on a WebPart class are normally displayed in the Editor Toolbar (in the default Miscellaneous category if not specified). Many times a developer might take the value of a property entered in the editor, and directly output it to the screen (i.e. new LiteralControl(QuoteOfTheDay) ). The issue with this is that if any html, script, etc&#8230; were injected into this property, by outputting it to the screen, malicious code could be run that affects all users to the site. Properties now have a new RequiresDesignerPermission attribute to determine if a property needs designer permissions in order to display on the editor toolbar, and SafeControl entries now have a new SafeAgainstScript attribute to control whether a control is protected. The default behavior without specifying either is that only designers can edit the properties. When SafeAgainstScript is set to true, and RequiresDesignerPermission attribute is set to false, then and only then, can Contributors gain access to edit the property. Going forward this should help to ensure developers are properly encoding values, etc&#8230;, before they mark a control as SafeAgainstScript and set RequiresDesignerPermission to false, if they are going to be outputting properties onto the screen.</p>
<p>(Note: personalized properties will not be affected by this new addition, since they would only display for an individual user, and would not be a risk to other viewers)</p>
<h2>Miscellaneous</h2>
<p>Here are a few things to look forward that don&#8217;t necessarily warrant their own section, but are nonetheless interesting:</p>
<ul>
<li>The ASP.Net WebPart class is still the preferred class to inherit over the SharePoint WebPart class</li>
<li>More functionality is being added to the ASP.Net WebPart class</li>
<li>Developers are encouraged to deploy WebParts as features, and not directly through the solution manifest file or other means</li>
<li>Thew new enhanced WIKI allows WebParts to be dropped into anywhere inside the main content area, without having to put it into a WebPartZone (This is all happening behind-the-scenes through a dynamic zone that pushes WebParts into placeholders)</li>
</ul>
<h2>Summary</h2>
<p>I hope this has been informative to some of you as to what we have to look forward to in WebParts inside SharePoint 2010. I am sure as Beta is released in November, and the product gets to release, there will be even more  gems to discover inside this new and very promising effort from Microsoft.</p>
<p>Cheers,<br />
Matt</p>

<div class="sociable">
<div class="sociable_tagline">
<p><strong>Share this post:</strong></p>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="mailto:?subject=SharePoint%202010%20WebPart%20Enhancements&amp;body=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2009%2F10%2F23%2Fsharepoint-2010-webpart-enhancements%2F" title="email"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=SharePoint%202010%20WebPart%20Enhancements%20-%20http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2009%2F10%2F23%2Fsharepoint-2010-webpart-enhancements%2F" title="Twitter"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2009%2F10%2F23%2Fsharepoint-2010-webpart-enhancements%2F&amp;t=SharePoint%202010%20WebPart%20Enhancements" title="Facebook"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2009%2F10%2F23%2Fsharepoint-2010-webpart-enhancements%2F&amp;title=SharePoint%202010%20WebPart%20Enhancements&amp;notes=It%27s%20been%20too%20long%20since%20my%20last%20post.%20I%20struggle%20as%20a%20blogger%20because%20I%20feel%20my%20time%20is%20better%20spent%20reading%20bloggers%20like%20Andrew%20Connell%2C%20Waldek%20Mastykarz%2C%20Eric%20Shupps%2C%20and%20so%20on%2C%20rather%20than%20writing%20my%20own%20content.%20I%20never%20imagined%20this%20long%20of%20a%20" title="del.icio.us"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2009%2F10%2F23%2Fsharepoint-2010-webpart-enhancements%2F&amp;title=SharePoint%202010%20WebPart%20Enhancements&amp;bodytext=It%27s%20been%20too%20long%20since%20my%20last%20post.%20I%20struggle%20as%20a%20blogger%20because%20I%20feel%20my%20time%20is%20better%20spent%20reading%20bloggers%20like%20Andrew%20Connell%2C%20Waldek%20Mastykarz%2C%20Eric%20Shupps%2C%20and%20so%20on%2C%20rather%20than%20writing%20my%20own%20content.%20I%20never%20imagined%20this%20long%20of%20a%20" title="Digg"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2009%2F10%2F23%2Fsharepoint-2010-webpart-enhancements%2F&amp;title=SharePoint%202010%20WebPart%20Enhancements&amp;annotation=It%27s%20been%20too%20long%20since%20my%20last%20post.%20I%20struggle%20as%20a%20blogger%20because%20I%20feel%20my%20time%20is%20better%20spent%20reading%20bloggers%20like%20Andrew%20Connell%2C%20Waldek%20Mastykarz%2C%20Eric%20Shupps%2C%20and%20so%20on%2C%20rather%20than%20writing%20my%20own%20content.%20I%20never%20imagined%20this%20long%20of%20a%20" title="Google Bookmarks"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2009%2F10%2F23%2Fsharepoint-2010-webpart-enhancements%2F&amp;title=SharePoint%202010%20WebPart%20Enhancements" title="StumbleUpon"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.mattjimison.com/blog/2009/10/23/sharepoint-2010-webpart-enhancements/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Twitter Search WebPart</title>
		<link>http://www.mattjimison.com/blog/2009/03/04/twitter-search-webpart/</link>
		<comments>http://www.mattjimison.com/blog/2009/03/04/twitter-search-webpart/#comments</comments>
		<pubDate>Thu, 05 Mar 2009 05:47:05 +0000</pubDate>
		<dc:creator>mjimison</dc:creator>
				<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Linq]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[Twitter]]></category>
		<category><![CDATA[WebPart]]></category>

		<guid isPermaLink="false">http://www.mattjimison.com/blog/?p=32</guid>
		<description><![CDATA[Download now: WSP Solution &#124; Source Code (zip) I used to play in a punk rock band, and we often joked that with only so many bar chords to play, we often copied our own songs unintentionally. When you are writing a blog, it can be difficult to know when someone else has already written [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Download now:</strong> <a href="http://www.mattjimison.com/downloads/MattJimison.Twitter.wsp">WSP Solution</a> | <a href="http://www.mattjimison.com/downloads/MattJimison.Twitter.zip">Source Code (zip)</a></p>
<p>I used to play in a punk rock band, and we often joked that with only so many bar chords to play, we often copied our own songs unintentionally. When you are writing a blog, it can be difficult to know when someone else has already written on the subject you&#8217;ve chosen, or if you&#8217;ve just coincidentally stumbled upon something already out there. I am positive there are other Twitter-related SharePoint posts written, but I haven&#8217;t seen any offer a configurable webpart like I&#8217;m about to do. If it&#8217;s been done before, I still consider the time I spent valuable, because this was a fun item to tackle.</p>
<p><strong>Finished Product Screenshots: </strong>(Click for larger images)</p>
<style type='text/css'>
			.gallery {
				margin: auto;
			}
			.gallery-item {
				float: left;
				margin-top: 10px;
				text-align: center;
				width: 50%;			}
			.gallery img {
				border: 2px solid #cfcfcf;
			}
			.gallery-caption {
				margin-left: 0;
			}
		</style>
<p>		<!-- see gallery_shortcode() in wp-includes/media.php --></p>
<div class='gallery'>
<dl class='gallery-item'>
<dt class='gallery-icon'>
				<a href='http://www.mattjimison.com/blog/wp-content/uploads/2009/03/twitter-toolpart.jpg' title='twitter-toolpart' target='_blank'><img src="http://www.mattjimison.com/blog/wp-content/uploads/2009/03/twitter-toolpart-150x150.jpg" width="150" height="150" class="attachment-thumbnail" alt="" /></a>
			</dt>
</dl>
<dl class='gallery-item'>
<dt class='gallery-icon'>
				<a href='http://www.mattjimison.com/blog/wp-content/uploads/2009/03/twitter-display.jpg' title='twitter-display' target='_blank'><img src="http://www.mattjimison.com/blog/wp-content/uploads/2009/03/twitter-display-150x150.jpg" width="150" height="150" class="attachment-thumbnail" alt="" /></a>
			</dt>
</dl>
<p><br style="clear: both" /><br />
			<br style='clear: both;' />
		</div>
<p><strong>Here are the inspirations for my post, including some of the source code for querying the Twitter Search API via Linq:</strong></p>
<ul>
<li><a href="http://weblogs.asp.net/jan/archive/2009/03/02/the-twitter-search-api-made-easy-with-linq-to-xml.aspx" target="_blank">Jan Tielens&#8217; The Twitter Search API made easy with Linq to XML</a></li>
<li><a href="http://blogs.msdn.com/roberthorvick/archive/2009/01/27/reading-twitter-data-with-c-and-linq.aspx" target="_blank">Robert Horvick&#8217;s Reading Twitter Data with C# and LINQ</a></li>
</ul>
<p><strong>Here is how I made this project my own:</strong></p>
<ol>
<li>Created a <a href="http://www.mattjimison.com/downloads/MattJimison.Twitter.wsp">solution</a> that contains a site-scoped feature for adding a Twitter Search WebPart to your site (<a href="http://www.mattjimison.com/downloads/MattJimison.Twitter.wsp">WSP available for Download</a>)</li>
<li>WebPart has the main <a href="http://apiwiki.twitter.com/Search+API+Documentation" target="_blank">Twitter search API</a> query abilities:
<ol>
<li>General search term</li>
<li>From user</li>
<li>To user</li>
<li>About user</li>
<li>Hashtag</li>
</ol>
</li>
<li>Added the ability to define a QueryString variable that overrides the webpart configuration and takes the search directly from the QueryString</li>
<li>Used caching in combination with Since_Id to cut back on amount of data being brought back with each request</li>
<li>Solution deploys a custom css file to the 12 hive, which is embedded into the head of pages that include the webpart (easy to customize for your style)</li>
<li>Enhanced the Linq query to bring back the profile images (or substitute Twitter&#8217;s default image when one is not present)</li>
<li>Added the ability to turn profile images on and off in results display</li>
<li>Used regular expressions to hyperlink usernames and urls embedded in status updates (text search returns has html stripped)</li>
<li>There are no SharePoint references in the webpart, and it inherits from the regular WebPart class, so it could easily be used in an ASP.Net 3.5 Application</li>
</ol>
<p>The <a href="http://www.mattjimison.com/downloads/MattJimison.Twitter.zip">source code</a> and <a href="http://www.mattjimison.com/downloads/MattJimison.Twitter.wsp">wsp file</a> are both available for download. You will need <a href="http://www.codeplex.com/wspbuilder" target="_blank">WSPBuilder</a> installed if you wish to work with the provided source code, as that is my choice of development tool, and since Linq, lambda expressions, etc&#8230; are used, you will also need the ASP.Net 3.5 Framework to run this webpart.</p>
<p><strong>Installation Instructions:</strong></p>
<ol>
<li>Download wsp to your server</li>
<li>Run the following stsadm commands on the solution file (Best to run in directory where you have copied the solution)
<ol>
<li>stsadm -o addsolution -filename MattJimison.Twitter.wsp</li>
<li>stsadm -o deploysolution -name MattJimison.Twitter.wsp -url <strong>http://yoursite.com</strong> -immediate -allowgacdeployment</li>
<li>stsadm -o execadmsvcjobs</li>
<li>stsadm -o activatefeature -filename TwitterSearchWebPart\feature.xml -url <strong>http://yoursite.com</strong></li>
</ol>
</li>
<li>The WebPart will be located under the group &#8216;mattjimison.com&#8217;</li>
</ol>
<hr /><strong>Closing Thoughts:</strong><br />
This was a fun project to create. There are already so many great Twitter applications out there, and I thought it would be fun to get a WebPart started. There was a lot more I wanted to do, but I might save that for a future post. Although you could derive a solution using the oob xml webpart, it would not be as configurable, utilize Since_Id that the Twitter API recommends, or be easy for a non-developer to work with. I see this webpart as a great way to keep tabs on what people are saying about something (your company for instance) or focus in on some key individual communications while remaining on your own site. Thanks for reading, and be sure to <a href="http://www.twitter.com/mjimison" target="_blank">look me up on Twitter</a>.</p>
<p>Cheers.</p>
<p>Matt</p>
<hr /><strong>Downloads</strong><br />
<a href="http://www.mattjimison.com/downloads/MattJimison.Twitter.wsp">WSP Solution</a><br />
<a href="http://www.mattjimison.com/downloads/MattJimison.Twitter.zip">Source Code (zip)</a></p>
<hr />
<strong> Source code for main webpart class:</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
</pre></td><td class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Collections.Generic</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.ComponentModel</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Linq</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Runtime.InteropServices</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Text</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Text.RegularExpressions</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Web</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Web.Caching</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Web.UI</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Web.UI.HtmlControls</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Web.UI.WebControls</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Web.UI.WebControls.WebParts</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Xml.Linq</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #0600FF; font-weight: bold;">namespace</span> MattJimison<span style="color: #008000;">.</span><span style="color: #0000FF;">Twitter</span>
<span style="color: #008000;">&#123;</span>
    <span style="color: #008000;">&#91;</span>Guid<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;d7bd616b-fa72-4299-a1c1-4c2d79f1970d&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> TwitterSearchWebPart <span style="color: #008000;">:</span> WebPart
    <span style="color: #008000;">&#123;</span>
&nbsp;
        <span style="color: #008080;">#region Properties / Fields</span>
        <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">bool</span> m_DisplayImage <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#91;</span>Personalizable<span style="color: #008000;">&#40;</span>PersonalizationScope<span style="color: #008000;">.</span><span style="color: #0000FF;">User</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
        <span style="color: #008000;">&#91;</span>WebBrowsable<span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
        <span style="color: #008000;">&#91;</span>Category<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Twitter Search&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
        <span style="color: #008000;">&#91;</span>WebDisplayName<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Display Profile Image&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
        <span style="color: #008000;">&#91;</span>WebDescription<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Display Profile Image&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">bool</span> DisplayImage
        <span style="color: #008000;">&#123;</span>
            get <span style="color: #008000;">&#123;</span> <span style="color: #0600FF; font-weight: bold;">return</span> m_DisplayImage<span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
            set <span style="color: #008000;">&#123;</span> m_DisplayImage <span style="color: #008000;">=</span> value<span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
        <span style="color: #008000;">&#125;</span>
&nbsp;
        <span style="color: #008000;">&#91;</span>Personalizable<span style="color: #008000;">&#40;</span>PersonalizationScope<span style="color: #008000;">.</span><span style="color: #0000FF;">User</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
        <span style="color: #008000;">&#91;</span>WebBrowsable<span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
        <span style="color: #008000;">&#91;</span>Category<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Twitter Search&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
        <span style="color: #008000;">&#91;</span>WebDisplayName<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Search Text&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
        <span style="color: #008000;">&#91;</span>WebDescription<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Search Text&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">string</span> SearchText <span style="color: #008000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
&nbsp;
        <span style="color: #008000;">&#91;</span>Personalizable<span style="color: #008000;">&#40;</span>PersonalizationScope<span style="color: #008000;">.</span><span style="color: #0000FF;">User</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
        <span style="color: #008000;">&#91;</span>WebBrowsable<span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
        <span style="color: #008000;">&#91;</span>Category<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Twitter Search&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
        <span style="color: #008000;">&#91;</span>WebDisplayName<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;From&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
        <span style="color: #008000;">&#91;</span>WebDescription<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;From User&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">string</span> <span style="color: #0600FF; font-weight: bold;">From</span> <span style="color: #008000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
&nbsp;
        <span style="color: #008000;">&#91;</span>Personalizable<span style="color: #008000;">&#40;</span>PersonalizationScope<span style="color: #008000;">.</span><span style="color: #0000FF;">User</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
        <span style="color: #008000;">&#91;</span>WebBrowsable<span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
        <span style="color: #008000;">&#91;</span>Category<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Twitter Search&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
        <span style="color: #008000;">&#91;</span>WebDisplayName<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;To&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
        <span style="color: #008000;">&#91;</span>WebDescription<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;To User&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">string</span> To <span style="color: #008000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
&nbsp;
        <span style="color: #008000;">&#91;</span>Personalizable<span style="color: #008000;">&#40;</span>PersonalizationScope<span style="color: #008000;">.</span><span style="color: #0000FF;">User</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
        <span style="color: #008000;">&#91;</span>WebBrowsable<span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
        <span style="color: #008000;">&#91;</span>Category<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Twitter Search&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
        <span style="color: #008000;">&#91;</span>WebDisplayName<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;About&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
        <span style="color: #008000;">&#91;</span>WebDescription<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;About User&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">string</span> About <span style="color: #008000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
&nbsp;
        <span style="color: #008000;">&#91;</span>Personalizable<span style="color: #008000;">&#40;</span>PersonalizationScope<span style="color: #008000;">.</span><span style="color: #0000FF;">User</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
        <span style="color: #008000;">&#91;</span>WebBrowsable<span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
        <span style="color: #008000;">&#91;</span>Category<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Twitter Search&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
        <span style="color: #008000;">&#91;</span>WebDisplayName<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Hashtag&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
        <span style="color: #008000;">&#91;</span>WebDescription<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Hashtag&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">string</span> HashTag <span style="color: #008000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
&nbsp;
        <span style="color: #008000;">&#91;</span>Personalizable<span style="color: #008000;">&#40;</span>PersonalizationScope<span style="color: #008000;">.</span><span style="color: #0000FF;">User</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
        <span style="color: #008000;">&#91;</span>WebBrowsable<span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
        <span style="color: #008000;">&#91;</span>Category<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Twitter Search&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
        <span style="color: #008000;">&#91;</span>WebDisplayName<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;QueryString Variable&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
        <span style="color: #008000;">&#91;</span>WebDescription<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;QueryString Variable&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">string</span> QueryStringVariable <span style="color: #008000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">public</span> List<span style="color: #008000;">&lt;</span>Tweet<span style="color: #008000;">&gt;</span> CachedTweets
        <span style="color: #008000;">&#123;</span>
            get
            <span style="color: #008000;">&#123;</span>
                <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>HttpContext<span style="color: #008000;">.</span><span style="color: #0000FF;">Current</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Cache</span><span style="color: #008000;">&#91;</span>m_Query<span style="color: #008000;">&#93;</span> <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span>
                <span style="color: #008000;">&#123;</span>
                    <span style="color: #0600FF; font-weight: bold;">return</span> <span style="color: #008000;">&#40;</span>List<span style="color: #008000;">&lt;</span>Tweet<span style="color: #008000;">&gt;</span><span style="color: #008000;">&#41;</span>HttpContext<span style="color: #008000;">.</span><span style="color: #0000FF;">Current</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Cache</span><span style="color: #008000;">&#91;</span>m_Query<span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
                <span style="color: #008000;">&#125;</span>
                <span style="color: #0600FF; font-weight: bold;">else</span>
                <span style="color: #008000;">&#123;</span>
                    <span style="color: #0600FF; font-weight: bold;">return</span> <span style="color: #008000;">new</span> List<span style="color: #008000;">&lt;</span>Tweet<span style="color: #008000;">&gt;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                <span style="color: #008000;">&#125;</span>
            <span style="color: #008000;">&#125;</span>
&nbsp;
            set
            <span style="color: #008000;">&#123;</span>
                <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>HttpContext<span style="color: #008000;">.</span><span style="color: #0000FF;">Current</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Cache</span><span style="color: #008000;">&#91;</span>m_Query<span style="color: #008000;">&#93;</span> <span style="color: #008000;">==</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span>
                <span style="color: #008000;">&#123;</span>
                    HttpContext<span style="color: #008000;">.</span><span style="color: #0000FF;">Current</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Cache</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span>m_Query, value, <span style="color: #0600FF; font-weight: bold;">null</span>, DateTime<span style="color: #008000;">.</span><span style="color: #0000FF;">Now</span><span style="color: #008000;">.</span><span style="color: #0000FF;">AddMinutes</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">5</span><span style="color: #008000;">&#41;</span>,
                        Cache<span style="color: #008000;">.</span><span style="color: #0000FF;">NoSlidingExpiration</span>, CacheItemPriority<span style="color: #008000;">.</span><span style="color: #0000FF;">Normal</span>, <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                <span style="color: #008000;">&#125;</span>
                <span style="color: #0600FF; font-weight: bold;">else</span>
                <span style="color: #008000;">&#123;</span>
                    HttpContext<span style="color: #008000;">.</span><span style="color: #0000FF;">Current</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Cache</span><span style="color: #008000;">&#91;</span>m_Query<span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> value<span style="color: #008000;">;</span>
                <span style="color: #008000;">&#125;</span>
            <span style="color: #008000;">&#125;</span>
        <span style="color: #008000;">&#125;</span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">string</span> CachedSinceId
        <span style="color: #008000;">&#123;</span>
            get
            <span style="color: #008000;">&#123;</span>
                <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>HttpContext<span style="color: #008000;">.</span><span style="color: #0000FF;">Current</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Cache</span><span style="color: #008000;">&#91;</span>m_SinceIdPrefix <span style="color: #008000;">+</span> m_Query<span style="color: #008000;">&#93;</span> <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span>
                <span style="color: #008000;">&#123;</span>
                    <span style="color: #0600FF; font-weight: bold;">return</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">&#41;</span>HttpContext<span style="color: #008000;">.</span><span style="color: #0000FF;">Current</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Cache</span><span style="color: #008000;">&#91;</span>m_SinceIdPrefix <span style="color: #008000;">+</span> m_Query<span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
                <span style="color: #008000;">&#125;</span>
                <span style="color: #0600FF; font-weight: bold;">else</span>
                <span style="color: #008000;">&#123;</span>
                    <span style="color: #0600FF; font-weight: bold;">return</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">;</span>
                <span style="color: #008000;">&#125;</span>
            <span style="color: #008000;">&#125;</span>
&nbsp;
            set
            <span style="color: #008000;">&#123;</span>
                <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>HttpContext<span style="color: #008000;">.</span><span style="color: #0000FF;">Current</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Cache</span><span style="color: #008000;">&#91;</span>m_SinceIdPrefix <span style="color: #008000;">+</span> m_Query<span style="color: #008000;">&#93;</span> <span style="color: #008000;">==</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span>
                <span style="color: #008000;">&#123;</span>
                    HttpContext<span style="color: #008000;">.</span><span style="color: #0000FF;">Current</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Cache</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span>m_SinceIdPrefix <span style="color: #008000;">+</span> m_Query, value, <span style="color: #0600FF; font-weight: bold;">null</span>, DateTime<span style="color: #008000;">.</span><span style="color: #0000FF;">Now</span><span style="color: #008000;">.</span><span style="color: #0000FF;">AddMinutes</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">5</span><span style="color: #008000;">&#41;</span>,
                        Cache<span style="color: #008000;">.</span><span style="color: #0000FF;">NoSlidingExpiration</span>, CacheItemPriority<span style="color: #008000;">.</span><span style="color: #0000FF;">Normal</span>, <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                <span style="color: #008000;">&#125;</span>
                <span style="color: #0600FF; font-weight: bold;">else</span>
                <span style="color: #008000;">&#123;</span>
                    HttpContext<span style="color: #008000;">.</span><span style="color: #0000FF;">Current</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Cache</span><span style="color: #008000;">&#91;</span>m_SinceIdPrefix <span style="color: #008000;">+</span> m_Query<span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> value<span style="color: #008000;">;</span>
                <span style="color: #008000;">&#125;</span>
&nbsp;
            <span style="color: #008000;">&#125;</span>
        <span style="color: #008000;">&#125;</span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">string</span> m_Query <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #0600FF; font-weight: bold;">readonly</span> <span style="color: #6666cc; font-weight: bold;">string</span> m_DefaultProfileImage <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;http://static.twitter.com/images/default_profile_normal.png&quot;</span><span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #0600FF; font-weight: bold;">readonly</span> <span style="color: #6666cc; font-weight: bold;">string</span> m_SinceIdPrefix <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;SinceId::&quot;</span><span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #0600FF; font-weight: bold;">readonly</span> <span style="color: #6666cc; font-weight: bold;">string</span> m_UrlTemplate <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;http://search.twitter.com/search.atom?q={0}&amp;since_id={1}&quot;</span><span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #0600FF; font-weight: bold;">static</span> XNamespace <span style="color: #008080;">m_AtomNS </span><span style="color: #008000;">=</span> <span style="color: #666666;">&quot;http://www.w3.org/2005/Atom&quot;</span><span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #0600FF; font-weight: bold;">static</span> Regex m_TwitterName <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Regex<span style="color: #008000;">&#40;</span><span style="color: #666666;">@&quot;@([\w_]+)&quot;</span>, RegexOptions<span style="color: #008000;">.</span><span style="color: #0000FF;">Compiled</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #0600FF; font-weight: bold;">static</span> Regex m_Url <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Regex<span style="color: #008000;">&#40;</span><span style="color: #666666;">@&quot;(https?://([\w-]+\.)+[\w-]+([^ ]*))&quot;</span>, RegexOptions<span style="color: #008000;">.</span><span style="color: #0000FF;">Compiled</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #008080;">#endregion</span>
&nbsp;
        <span style="color: #008080;">#region CreateChildControls</span>
        <span style="color: #0600FF; font-weight: bold;">protected</span> <span style="color: #0600FF; font-weight: bold;">override</span> <span style="color: #6666cc; font-weight: bold;">void</span> CreateChildControls<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            <span style="color: #0600FF; font-weight: bold;">base</span><span style="color: #008000;">.</span><span style="color: #0000FF;">CreateChildControls</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #0600FF; font-weight: bold;">try</span>
            <span style="color: #008000;">&#123;</span>
                AddStylesheet<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                BuildQuery<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                DisplayResults<span style="color: #008000;">&#40;</span>GetTweets<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #008000;">&#125;</span>
            <span style="color: #0600FF; font-weight: bold;">catch</span> <span style="color: #008000;">&#40;</span>Exception ex<span style="color: #008000;">&#41;</span>
            <span style="color: #008000;">&#123;</span>
                <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Controls</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">new</span> LiteralControl<span style="color: #008000;">&#40;</span>ex<span style="color: #008000;">.</span><span style="color: #0000FF;">Message</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;&lt;br /&gt;&quot;</span> <span style="color: #008000;">+</span>
                    ex<span style="color: #008000;">.</span><span style="color: #0000FF;">StackTrace</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;&lt;br /&gt;&quot;</span> <span style="color: #008000;">+</span> ex<span style="color: #008000;">.</span><span style="color: #0000FF;">Source</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #008000;">&#125;</span>
        <span style="color: #008000;">&#125;</span>
        <span style="color: #008080;">#endregion</span>
&nbsp;
        <span style="color: #008080;">#region AddStylesheet</span>
        <span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
        <span style="color: #008080; font-style: italic;">/// Add stylesheet reference to page's head section</span>
        <span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
        <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">void</span> AddStylesheet<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            <span style="color: #008080; font-style: italic;">//Dynamically add css reference</span>
            HtmlLink cssLink <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> HtmlLink<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            cssLink<span style="color: #008000;">.</span><span style="color: #0000FF;">Href</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;~/_layouts/MattJimison/css/twitter.css&quot;</span><span style="color: #008000;">;</span>
            cssLink<span style="color: #008000;">.</span><span style="color: #0000FF;">Attributes</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;rel&quot;</span>, <span style="color: #666666;">&quot;Stylesheet&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            cssLink<span style="color: #008000;">.</span><span style="color: #0000FF;">Attributes</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;type&quot;</span>, <span style="color: #666666;">&quot;text/css&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            cssLink<span style="color: #008000;">.</span><span style="color: #0000FF;">Attributes</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;media&quot;</span>, <span style="color: #666666;">&quot;all&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            Page<span style="color: #008000;">.</span><span style="color: #0000FF;">Header</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Controls</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span>cssLink<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
        <span style="color: #008080;">#endregion</span>
&nbsp;
        <span style="color: #008080;">#region BuildQuery</span>
        <span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
        <span style="color: #008080; font-style: italic;">/// Build dynamic query or read from querystring</span>
        <span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
        <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">void</span> BuildQuery<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            <span style="color: #008080; font-style: italic;">//If Querystring variable is set, read from QueryString</span>
            <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">!</span><span style="color: #6666cc; font-weight: bold;">String</span><span style="color: #008000;">.</span><span style="color: #0000FF;">IsNullOrEmpty</span><span style="color: #008000;">&#40;</span>QueryStringVariable<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&amp;&amp;</span>
                <span style="color: #008000;">!</span><span style="color: #6666cc; font-weight: bold;">String</span><span style="color: #008000;">.</span><span style="color: #0000FF;">IsNullOrEmpty</span><span style="color: #008000;">&#40;</span>HttpContext<span style="color: #008000;">.</span><span style="color: #0000FF;">Current</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Request</span><span style="color: #008000;">.</span><span style="color: #0000FF;">QueryString</span><span style="color: #008000;">&#91;</span>QueryStringVariable<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
            <span style="color: #008000;">&#123;</span>
                m_Query <span style="color: #008000;">=</span> HttpContext<span style="color: #008000;">.</span><span style="color: #0000FF;">Current</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Request</span><span style="color: #008000;">.</span><span style="color: #0000FF;">QueryString</span><span style="color: #008000;">&#91;</span>QueryStringVariable<span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
            <span style="color: #008000;">&#125;</span>
&nbsp;
            <span style="color: #0600FF; font-weight: bold;">else</span>
            <span style="color: #008000;">&#123;</span>
                <span style="color: #008080; font-style: italic;">//Dynamically Build Query</span>
                List<span style="color: #008000;">&lt;</span><span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">&gt;</span> patterns <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> List<span style="color: #008000;">&lt;</span><span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">&gt;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">!</span><span style="color: #6666cc; font-weight: bold;">String</span><span style="color: #008000;">.</span><span style="color: #0000FF;">IsNullOrEmpty</span><span style="color: #008000;">&#40;</span>SearchText<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
                    patterns<span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span>SearchText<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
                <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">!</span><span style="color: #6666cc; font-weight: bold;">String</span><span style="color: #008000;">.</span><span style="color: #0000FF;">IsNullOrEmpty</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">From</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
                    patterns<span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;from:&quot;</span> <span style="color: #008000;">+</span> <span style="color: #0600FF; font-weight: bold;">From</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
                <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">!</span><span style="color: #6666cc; font-weight: bold;">String</span><span style="color: #008000;">.</span><span style="color: #0000FF;">IsNullOrEmpty</span><span style="color: #008000;">&#40;</span>To<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
                    patterns<span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;to:&quot;</span> <span style="color: #008000;">+</span> To<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
                <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">!</span><span style="color: #6666cc; font-weight: bold;">String</span><span style="color: #008000;">.</span><span style="color: #0000FF;">IsNullOrEmpty</span><span style="color: #008000;">&#40;</span>About<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
                    patterns<span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;@&quot;</span> <span style="color: #008000;">+</span> About<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
                <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">!</span><span style="color: #6666cc; font-weight: bold;">String</span><span style="color: #008000;">.</span><span style="color: #0000FF;">IsNullOrEmpty</span><span style="color: #008000;">&#40;</span>HashTag<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
                    patterns<span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;#&quot;</span> <span style="color: #008000;">+</span> HashTag<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
                <span style="color: #008080; font-style: italic;">//Join patterns with + delimiter</span>
                m_Query <span style="color: #008000;">=</span> <span style="color: #6666cc; font-weight: bold;">String</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Join</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;+&quot;</span>, patterns<span style="color: #008000;">.</span><span style="color: #0000FF;">ToArray</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
                <span style="color: #008080; font-style: italic;">//UrlEncode</span>
                m_Query <span style="color: #008000;">=</span> HttpUtility<span style="color: #008000;">.</span><span style="color: #0000FF;">UrlEncode</span><span style="color: #008000;">&#40;</span>m_Query<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #008000;">&#125;</span>
        <span style="color: #008000;">&#125;</span>
        <span style="color: #008080;">#endregion</span>
&nbsp;
        <span style="color: #008080;">#region GetTweets</span>
        <span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
        <span style="color: #008080; font-style: italic;">/// Obtain list of tweets from Twitter search API and merge with cached</span>
        <span style="color: #008080; font-style: italic;">/// items using the previous SinceId</span>
        <span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;returns&gt;Returns combined list of tweets&lt;/returns&gt;</span>
        <span style="color: #0600FF; font-weight: bold;">private</span> List<span style="color: #008000;">&lt;</span>Tweet<span style="color: #008000;">&gt;</span> GetTweets<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            List<span style="color: #008000;">&lt;</span>Tweet<span style="color: #008000;">&gt;</span> results <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> List<span style="color: #008000;">&lt;</span>Tweet<span style="color: #008000;">&gt;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">//Do not search on empty  query</span>
            <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">String</span><span style="color: #008000;">.</span><span style="color: #0000FF;">IsNullOrEmpty</span><span style="color: #008000;">&#40;</span>m_Query<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
                <span style="color: #0600FF; font-weight: bold;">return</span> results<span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">//Retrieve cached results from same query</span>
            List<span style="color: #008000;">&lt;</span>Tweet<span style="color: #008000;">&gt;</span> oldResults <span style="color: #008000;">=</span> CachedTweets<span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">//Load in the search results</span>
            XDocument xDoc <span style="color: #008000;">=</span> XDocument<span style="color: #008000;">.</span><span style="color: #0000FF;">Load</span><span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Format</span><span style="color: #008000;">&#40;</span>m_UrlTemplate, m_Query, CachedSinceId<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">//Populate the Tweet list</span>
            <span style="color: #008080; font-style: italic;">//Users that have default image won't have this image in search results so that is what</span>
            <span style="color: #008080; font-style: italic;">//DefaultIfEmtpy(m_DefaultProfileImage).First() is for, to point to static image</span>
            List<span style="color: #008000;">&lt;</span>Tweet<span style="color: #008000;">&gt;</span> newResults <span style="color: #008000;">=</span>
            <span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">from</span> tweet <span style="color: #0600FF; font-weight: bold;">in</span> xDoc<span style="color: #008000;">.</span><span style="color: #0000FF;">Descendants</span><span style="color: #008000;">&#40;</span>m_AtomNS <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;entry&quot;</span><span style="color: #008000;">&#41;</span>
             <span style="color: #0600FF; font-weight: bold;">select</span> <span style="color: #008000;">new</span> Tweet
             <span style="color: #008000;">&#123;</span>
                 Title <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">&#41;</span>tweet<span style="color: #008000;">.</span><span style="color: #0000FF;">Element</span><span style="color: #008000;">&#40;</span>m_AtomNS <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;title&quot;</span><span style="color: #008000;">&#41;</span>,
                 Published <span style="color: #008000;">=</span>
                    DateTime<span style="color: #008000;">.</span><span style="color: #0000FF;">Parse</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">&#41;</span>tweet<span style="color: #008000;">.</span><span style="color: #0000FF;">Element</span><span style="color: #008000;">&#40;</span>m_AtomNS <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;published&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>,
                 Id <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">&#41;</span>tweet<span style="color: #008000;">.</span><span style="color: #0000FF;">Element</span><span style="color: #008000;">&#40;</span>m_AtomNS <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;id&quot;</span><span style="color: #008000;">&#41;</span>,
                 Link <span style="color: #008000;">=</span> tweet<span style="color: #008000;">.</span><span style="color: #0000FF;">Elements</span><span style="color: #008000;">&#40;</span>m_AtomNS <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;link&quot;</span><span style="color: #008000;">&#41;</span>
                    <span style="color: #008000;">.</span><span style="color: #0600FF; font-weight: bold;">Where</span><span style="color: #008000;">&#40;</span>link <span style="color: #008000;">=&gt;</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">&#41;</span>link<span style="color: #008000;">.</span><span style="color: #0000FF;">Attribute</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;rel&quot;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">==</span> <span style="color: #666666;">&quot;alternate&quot;</span><span style="color: #008000;">&#41;</span>
                    <span style="color: #008000;">.</span><span style="color: #0600FF; font-weight: bold;">Select</span><span style="color: #008000;">&#40;</span>link <span style="color: #008000;">=&gt;</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">&#41;</span>link<span style="color: #008000;">.</span><span style="color: #0000FF;">Attribute</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;href&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
                    <span style="color: #008000;">.</span><span style="color: #0000FF;">First</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>,
                 ProfileImage <span style="color: #008000;">=</span> tweet<span style="color: #008000;">.</span><span style="color: #0000FF;">Elements</span><span style="color: #008000;">&#40;</span>m_AtomNS <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;link&quot;</span><span style="color: #008000;">&#41;</span>
                    <span style="color: #008000;">.</span><span style="color: #0600FF; font-weight: bold;">Where</span><span style="color: #008000;">&#40;</span>link <span style="color: #008000;">=&gt;</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">&#41;</span>link<span style="color: #008000;">.</span><span style="color: #0000FF;">Attribute</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;rel&quot;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">==</span> <span style="color: #666666;">&quot;image&quot;</span><span style="color: #008000;">&#41;</span>
                    <span style="color: #008000;">.</span><span style="color: #0600FF; font-weight: bold;">Select</span><span style="color: #008000;">&#40;</span>link <span style="color: #008000;">=&gt;</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">&#41;</span>link<span style="color: #008000;">.</span><span style="color: #0000FF;">Attribute</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;href&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
                    <span style="color: #008000;">.</span><span style="color: #0000FF;">DefaultIfEmpty</span><span style="color: #008000;">&#40;</span>m_DefaultProfileImage<span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">First</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>,
                 Author <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">from</span> author <span style="color: #0600FF; font-weight: bold;">in</span> tweet<span style="color: #008000;">.</span><span style="color: #0000FF;">Descendants</span><span style="color: #008000;">&#40;</span>m_AtomNS <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;author&quot;</span><span style="color: #008000;">&#41;</span>
                           <span style="color: #0600FF; font-weight: bold;">select</span> <span style="color: #008000;">new</span> Author
                           <span style="color: #008000;">&#123;</span>
                               Name <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">&#41;</span>author<span style="color: #008000;">.</span><span style="color: #0000FF;">Element</span><span style="color: #008000;">&#40;</span>m_AtomNS <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;name&quot;</span><span style="color: #008000;">&#41;</span>,
                               Uri <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">&#41;</span>author<span style="color: #008000;">.</span><span style="color: #0000FF;">Element</span><span style="color: #008000;">&#40;</span>m_AtomNS <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;uri&quot;</span><span style="color: #008000;">&#41;</span>,
                           <span style="color: #008000;">&#125;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">First</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
             <span style="color: #008000;">&#125;</span>
             <span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ToList</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">//Concat old and new values and sort by id descending</span>
            results <span style="color: #008000;">=</span> oldResults<span style="color: #008000;">.</span><span style="color: #0000FF;">Concat</span><span style="color: #008000;">&#40;</span>newResults<span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">OrderByDescending</span><span style="color: #008000;">&#40;</span>tweet <span style="color: #008000;">=&gt;</span> tweet<span style="color: #008000;">.</span><span style="color: #0000FF;">Id</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ToList</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">//Cache results when present</span>
            <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>results<span style="color: #008000;">.</span><span style="color: #0000FF;">Count</span> <span style="color: #008000;">&gt;</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span>
            <span style="color: #008000;">&#123;</span>
                <span style="color: #008080; font-style: italic;">//Split the id up to grab the numerical portion</span>
                <span style="color: #008080; font-style: italic;">//Example of how it comes through: tag:search.twitter.com,2005:1282047900</span>
                <span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> idParts <span style="color: #008000;">=</span> results<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Id</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Split</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">':'</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                CachedSinceId <span style="color: #008000;">=</span> idParts<span style="color: #008000;">&#91;</span>idParts<span style="color: #008000;">.</span><span style="color: #0000FF;">Length</span> <span style="color: #008000;">-</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
                CachedTweets <span style="color: #008000;">=</span> results<span style="color: #008000;">;</span>
            <span style="color: #008000;">&#125;</span>
&nbsp;
            <span style="color: #0600FF; font-weight: bold;">return</span> results<span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
        <span style="color: #008080;">#endregion</span>
&nbsp;
        <span style="color: #008080;">#region DisplayResults</span>
        <span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
        <span style="color: #008080; font-style: italic;">/// Creates dynamic controls containing data</span>
        <span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;results&quot;&gt;List of tweets to display&lt;/param&gt;</span>
        <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">void</span> DisplayResults<span style="color: #008000;">&#40;</span>List<span style="color: #008000;">&lt;</span>Tweet<span style="color: #008000;">&gt;</span> results<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            <span style="color: #008080; font-style: italic;">//Variable setup</span>
            Literal content <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Literal<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            StringBuilder txt <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> StringBuilder<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #6666cc; font-weight: bold;">string</span> profileImage <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">;</span>
            <span style="color: #6666cc; font-weight: bold;">string</span> authorName <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">;</span>
            <span style="color: #6666cc; font-weight: bold;">string</span> authorUri <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">;</span>
            <span style="color: #6666cc; font-weight: bold;">string</span> publishDate <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">;</span>
            <span style="color: #6666cc; font-weight: bold;">string</span> link <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">;</span>
            <span style="color: #6666cc; font-weight: bold;">string</span> title <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">;</span>
            <span style="color: #6666cc; font-weight: bold;">string</span> bodyClass <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">//Parent Panel</span>
            Panel panel <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Panel<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            panel<span style="color: #008000;">.</span><span style="color: #0000FF;">CssClass</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;tweet-searchheader&quot;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">//Display Header</span>
            <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">!</span><span style="color: #6666cc; font-weight: bold;">String</span><span style="color: #008000;">.</span><span style="color: #0000FF;">IsNullOrEmpty</span><span style="color: #008000;">&#40;</span>m_Query<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
            <span style="color: #008000;">&#123;</span>
                <span style="color: #008080; font-style: italic;">//Decode since m_Query is url-encoded and htmlencode for protection</span>
                txt<span style="color: #008000;">.</span><span style="color: #0000FF;">Append</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;&lt;div class='tweet-search'&gt;&lt;strong&gt;Search Terms:&lt;/strong&gt; &quot;</span> <span style="color: #008000;">+</span>
                    HttpUtility<span style="color: #008000;">.</span><span style="color: #0000FF;">HtmlEncode</span><span style="color: #008000;">&#40;</span>HttpUtility<span style="color: #008000;">.</span><span style="color: #0000FF;">UrlDecode</span><span style="color: #008000;">&#40;</span>m_Query<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;&lt;/div&gt;&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #008000;">&#125;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">//Display no results found</span>
            <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>results<span style="color: #008000;">.</span><span style="color: #0000FF;">Count</span> <span style="color: #008000;">==</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span>
            <span style="color: #008000;">&#123;</span>
                txt<span style="color: #008000;">.</span><span style="color: #0000FF;">Append</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;&lt;div class=<span style="color: #008080; font-weight: bold;">\&quot;</span>tweet-emptysearch<span style="color: #008080; font-weight: bold;">\&quot;</span>&gt;The search returned no results.&lt;/div&gt;&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #008000;">&#125;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">//Display header</span>
            content<span style="color: #008000;">.</span><span style="color: #0000FF;">Text</span> <span style="color: #008000;">=</span> txt<span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            panel<span style="color: #008000;">.</span><span style="color: #0000FF;">Controls</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span>content<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Controls</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span>panel<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">//Return on empty queries</span>
            <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>results<span style="color: #008000;">.</span><span style="color: #0000FF;">Count</span> <span style="color: #008000;">==</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span>
            <span style="color: #008000;">&#123;</span>
                <span style="color: #0600FF; font-weight: bold;">return</span><span style="color: #008000;">;</span>
            <span style="color: #008000;">&#125;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">//start ol</span>
            txt <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> StringBuilder<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            txt<span style="color: #008000;">.</span><span style="color: #0000FF;">Append</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;&lt;ol class=<span style="color: #008080; font-weight: bold;">\&quot;</span>tweet-statuses<span style="color: #008080; font-weight: bold;">\&quot;</span>&gt;&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">//Iterate through results and add to controls</span>
            <span style="color: #0600FF; font-weight: bold;">foreach</span> <span style="color: #008000;">&#40;</span>Tweet result <span style="color: #0600FF; font-weight: bold;">in</span> results<span style="color: #008000;">&#41;</span>
            <span style="color: #008000;">&#123;</span>
                <span style="color: #008080; font-style: italic;">//Set variables</span>
                authorName <span style="color: #008000;">=</span> result<span style="color: #008000;">.</span><span style="color: #0000FF;">Author</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Name</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Replace</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;'&quot;</span>, <span style="color: #666666;">&quot;&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                authorUri <span style="color: #008000;">=</span> result<span style="color: #008000;">.</span><span style="color: #0000FF;">Author</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Uri</span><span style="color: #008000;">;</span>
                publishDate <span style="color: #008000;">=</span> result<span style="color: #008000;">.</span><span style="color: #0000FF;">Published</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;G&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                link <span style="color: #008000;">=</span> result<span style="color: #008000;">.</span><span style="color: #0000FF;">Link</span><span style="color: #008000;">;</span>
                title <span style="color: #008000;">=</span> AddHyperlinks<span style="color: #008000;">&#40;</span>result<span style="color: #008000;">.</span><span style="color: #0000FF;">Title</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
                <span style="color: #008080; font-style: italic;">//Start li</span>
                txt<span style="color: #008000;">.</span><span style="color: #0000FF;">Append</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;&lt;li class=<span style="color: #008080; font-weight: bold;">\&quot;</span>tweet-status<span style="color: #008080; font-weight: bold;">\&quot;</span>&gt;&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
                <span style="color: #008080; font-style: italic;">//Image handling only shows when images are to be displayed</span>
                <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>DisplayImage<span style="color: #008000;">&#41;</span>
                <span style="color: #008000;">&#123;</span>
                    profileImage <span style="color: #008000;">=</span> result<span style="color: #008000;">.</span><span style="color: #0000FF;">ProfileImage</span><span style="color: #008000;">;</span>
                    txt<span style="color: #008000;">.</span><span style="color: #0000FF;">AppendFormat</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;&lt;span class=<span style="color: #008080; font-weight: bold;">\&quot;</span>tweet-thumb<span style="color: #008080; font-weight: bold;">\&quot;</span>&gt;&lt;a class=<span style="color: #008080; font-weight: bold;">\&quot;</span>tweet-url<span style="color: #008080; font-weight: bold;">\&quot;</span> href=<span style="color: #008080; font-weight: bold;">\&quot;</span>{0}<span style="color: #008080; font-weight: bold;">\&quot;</span> &quot;</span> <span style="color: #008000;">+</span>
                        <span style="color: #666666;">&quot;target=<span style="color: #008080; font-weight: bold;">\&quot;</span>_blank<span style="color: #008080; font-weight: bold;">\&quot;</span>&gt;&lt;img class=<span style="color: #008080; font-weight: bold;">\&quot;</span>tweet-photo<span style="color: #008080; font-weight: bold;">\&quot;</span> src=<span style="color: #008080; font-weight: bold;">\&quot;</span>{1}<span style="color: #008080; font-weight: bold;">\&quot;</span> alt=<span style="color: #008080; font-weight: bold;">\&quot;</span>{2}<span style="color: #008080; font-weight: bold;">\&quot;</span> /&gt;&lt;/a&gt;&lt;/span&gt;&quot;</span>,
                        authorUri, profileImage, authorName<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                <span style="color: #008000;">&#125;</span>
&nbsp;
                <span style="color: #008080; font-style: italic;">//Author Link</span>
                bodyClass <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span>DisplayImage<span style="color: #008000;">&#41;</span> <span style="color: #008000;">?</span> <span style="color: #666666;">&quot;tweet-statusbody&quot;</span> <span style="color: #008000;">:</span> <span style="color: #666666;">&quot;tweet-statusbodyplain&quot;</span><span style="color: #008000;">;</span>
                txt<span style="color: #008000;">.</span><span style="color: #0000FF;">AppendFormat</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;&lt;span class=<span style="color: #008080; font-weight: bold;">\&quot;</span>{0}<span style="color: #008080; font-weight: bold;">\&quot;</span>&gt;&lt;strong&gt;&lt;a class=<span style="color: #008080; font-weight: bold;">\&quot;</span>screenname<span style="color: #008080; font-weight: bold;">\&quot;</span> href=<span style="color: #008080; font-weight: bold;">\&quot;</span>{1}<span style="color: #008080; font-weight: bold;">\&quot;</span> target=<span style="color: #008080; font-weight: bold;">\&quot;</span>_blank<span style="color: #008080; font-weight: bold;">\&quot;</span>&gt;{2}&lt;/a&gt;&lt;/strong&gt; &quot;</span>,
                    bodyClass, authorUri, authorName<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
                <span style="color: #008080; font-style: italic;">//Status Message</span>
                txt<span style="color: #008000;">.</span><span style="color: #0000FF;">AppendFormat</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;&lt;span class=<span style="color: #008080; font-weight: bold;">\&quot;</span>tweet-entrycontent<span style="color: #008080; font-weight: bold;">\&quot;</span>&gt;{0}&lt;/span&gt; &quot;</span>, title<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
                <span style="color: #008080; font-style: italic;">//Footer Message</span>
                txt<span style="color: #008000;">.</span><span style="color: #0000FF;">AppendFormat</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;&lt;span class=<span style="color: #008080; font-weight: bold;">\&quot;</span>tweet-entrymeta<span style="color: #008080; font-weight: bold;">\&quot;</span>&gt;&lt;a href=<span style="color: #008080; font-weight: bold;">\&quot;</span>{0}<span style="color: #008080; font-weight: bold;">\&quot;</span> class=<span style="color: #008080; font-weight: bold;">\&quot;</span>tweet-entrydate<span style="color: #008080; font-weight: bold;">\&quot;</span> target=<span style="color: #008080; font-weight: bold;">\&quot;</span>_blank<span style="color: #008080; font-weight: bold;">\&quot;</span>&gt;Posted at {1}&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&quot;</span>,
                    link, publishDate<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
                <span style="color: #008080; font-style: italic;">//Clear Element</span>
                txt<span style="color: #008000;">.</span><span style="color: #0000FF;">Append</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;&lt;div class=<span style="color: #008080; font-weight: bold;">\&quot;</span>clear<span style="color: #008080; font-weight: bold;">\&quot;</span>&gt;&lt;/div&gt;&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
                <span style="color: #008080; font-style: italic;">//End li</span>
                txt<span style="color: #008000;">.</span><span style="color: #0000FF;">Append</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;&lt;/li&gt;&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #008000;">&#125;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">//end ol</span>
            txt<span style="color: #008000;">.</span><span style="color: #0000FF;">Append</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;&lt;/ol&gt;&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">//Add Content</span>
            panel <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Panel<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            panel<span style="color: #008000;">.</span><span style="color: #0000FF;">CssClass</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;tweet-container&quot;</span><span style="color: #008000;">;</span>
            content <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Literal<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            content<span style="color: #008000;">.</span><span style="color: #0000FF;">Text</span> <span style="color: #008000;">=</span> txt<span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            panel<span style="color: #008000;">.</span><span style="color: #0000FF;">Controls</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span>content<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Controls</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span>panel<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #008000;">&#125;</span>
        <span style="color: #008080;">#endregion</span>
&nbsp;
        <span style="color: #008080;">#region AddHyperlinks</span>
        <span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
        <span style="color: #008080; font-style: italic;">/// Replace @username and hyperlink text with html anchor tags</span>
        <span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;text&quot;&gt;status text&lt;/param&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;returns&gt;status text with auto hyperlinks&lt;/returns&gt;</span>
        <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">string</span> AddHyperlinks<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span> text<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            text <span style="color: #008000;">=</span> m_Url<span style="color: #008000;">.</span><span style="color: #0000FF;">Replace</span><span style="color: #008000;">&#40;</span>text, <span style="color: #666666;">&quot;&lt;a href=<span style="color: #008080; font-weight: bold;">\&quot;</span>$1<span style="color: #008080; font-weight: bold;">\&quot;</span> target=<span style="color: #008080; font-weight: bold;">\&quot;</span>_blank<span style="color: #008080; font-weight: bold;">\&quot;</span>&gt;$1&lt;/a&gt;&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            text <span style="color: #008000;">=</span> m_TwitterName<span style="color: #008000;">.</span><span style="color: #0000FF;">Replace</span><span style="color: #008000;">&#40;</span>text, <span style="color: #666666;">&quot;&lt;a href=<span style="color: #008080; font-weight: bold;">\&quot;</span>http://www.twitter.com/$1<span style="color: #008080; font-weight: bold;">\&quot;</span> target=<span style="color: #008080; font-weight: bold;">\&quot;</span>_blank<span style="color: #008080; font-weight: bold;">\&quot;</span>&gt;@$1&lt;/a&gt;&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #0600FF; font-weight: bold;">return</span> text<span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
        <span style="color: #008080;">#endregion</span>
&nbsp;
    <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>


<div class="sociable">
<div class="sociable_tagline">
<p><strong>Share this post:</strong></p>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="mailto:?subject=Twitter%20Search%20WebPart&amp;body=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2009%2F03%2F04%2Ftwitter-search-webpart%2F" title="email"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Twitter%20Search%20WebPart%20-%20http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2009%2F03%2F04%2Ftwitter-search-webpart%2F" title="Twitter"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2009%2F03%2F04%2Ftwitter-search-webpart%2F&amp;t=Twitter%20Search%20WebPart" title="Facebook"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2009%2F03%2F04%2Ftwitter-search-webpart%2F&amp;title=Twitter%20Search%20WebPart&amp;notes=Download%20now%3A%20WSP%20Solution%20%7C%20Source%20Code%20%28zip%29%0D%0A%0D%0AI%20used%20to%20play%20in%20a%20punk%20rock%20band%2C%20and%20we%20often%20joked%20that%20with%20only%20so%20many%20bar%20chords%20to%20play%2C%20we%20often%20copied%20our%20own%20songs%20unintentionally.%20When%20you%20are%20writing%20a%20blog%2C%20it%20can%20be%20difficult%20to%20kno" title="del.icio.us"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2009%2F03%2F04%2Ftwitter-search-webpart%2F&amp;title=Twitter%20Search%20WebPart&amp;bodytext=Download%20now%3A%20WSP%20Solution%20%7C%20Source%20Code%20%28zip%29%0D%0A%0D%0AI%20used%20to%20play%20in%20a%20punk%20rock%20band%2C%20and%20we%20often%20joked%20that%20with%20only%20so%20many%20bar%20chords%20to%20play%2C%20we%20often%20copied%20our%20own%20songs%20unintentionally.%20When%20you%20are%20writing%20a%20blog%2C%20it%20can%20be%20difficult%20to%20kno" title="Digg"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2009%2F03%2F04%2Ftwitter-search-webpart%2F&amp;title=Twitter%20Search%20WebPart&amp;annotation=Download%20now%3A%20WSP%20Solution%20%7C%20Source%20Code%20%28zip%29%0D%0A%0D%0AI%20used%20to%20play%20in%20a%20punk%20rock%20band%2C%20and%20we%20often%20joked%20that%20with%20only%20so%20many%20bar%20chords%20to%20play%2C%20we%20often%20copied%20our%20own%20songs%20unintentionally.%20When%20you%20are%20writing%20a%20blog%2C%20it%20can%20be%20difficult%20to%20kno" title="Google Bookmarks"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2009%2F03%2F04%2Ftwitter-search-webpart%2F&amp;title=Twitter%20Search%20WebPart" title="StumbleUpon"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.mattjimison.com/blog/2009/03/04/twitter-search-webpart/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>How to Change the IIS Path for a SharePoint Web Application</title>
		<link>http://www.mattjimison.com/blog/2009/02/26/how-to-change-the-iis-path-for-a-sharepoint-web-application/</link>
		<comments>http://www.mattjimison.com/blog/2009/02/26/how-to-change-the-iis-path-for-a-sharepoint-web-application/#comments</comments>
		<pubDate>Fri, 27 Feb 2009 04:26:31 +0000</pubDate>
		<dc:creator>mjimison</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SharePoint]]></category>

		<guid isPermaLink="false">http://www.mattjimison.com/blog/?p=13</guid>
		<description><![CDATA[When creating a new web application in SharePoint, you choose the physical location of where the IIS website will be created. Once the application is born, however, there is no longer an option to change this path in Central Administration. You can very easily change it in IIS (by going to your website&#8217;s Properties -&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>When creating a new web application in SharePoint, you choose the physical location of where the IIS website will be created. Once the application is born, however, there is no longer an option to change this path in Central Administration. You can very easily change it in IIS (by going to your website&#8217;s Properties -&gt; Home Directory -&gt; Local Path), but once this is done, you will start running into trouble, as solution deployments will point to the web.config file at the old location.</p>
<p>Three quick steps need taken to successfully move the web application:</p>
<ol>
<li>Copy the current directory&#8217;s contents into your new directory</li>
<li>Make the change to the website&#8217;s local path in IIS (as described above)</li>
<li>Update the SharePoint web application to point to the new path</li>
</ol>
<p><strong>Note:</strong> If you have multiple servers in your farm, steps 1 and 2 will need made on each web server, but step 3 will only need done once.</p>
<p>The third step can be done without having to extend the site. Here are a couple options.</p>
<p><strong>Option 1: C# Console Application (Reference Microsoft.SharePoint.dll)</strong></p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.IO</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">Microsoft.SharePoint</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">Microsoft.SharePoint.Administration</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #0600FF; font-weight: bold;">namespace</span> IisPath
<span style="color: #008000;">&#123;</span>
  <span style="color: #6666cc; font-weight: bold;">class</span> Program
  <span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">void</span> Main<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> args<span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
      <span style="color: #0600FF; font-weight: bold;">try</span>
      <span style="color: #008000;">&#123;</span>
        <span style="color: #008080; font-style: italic;">//Open the site your web application hosts</span>
        <span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008000;">&#40;</span>SPSite site <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> SPSite<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;http://yoursite.com&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
&nbsp;
          <span style="color: #008080; font-style: italic;">//Grab a reference to the site's web application's IIS Settings</span>
          <span style="color: #008080; font-style: italic;">//Change SPUrlZone if application is not in default zone</span>
          SPIisSettings iisSettings <span style="color: #008000;">=</span> site<span style="color: #008000;">.</span><span style="color: #0000FF;">WebApplication</span><span style="color: #008000;">.</span><span style="color: #0000FF;">IisSettings</span><span style="color: #008000;">&#91;</span>SPUrlZone<span style="color: #008000;">.</span><span style="color: #0600FF; font-weight: bold;">Default</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
&nbsp;
          <span style="color: #008080; font-style: italic;">//Point to your new path</span>
          iisSettings<span style="color: #008000;">.</span><span style="color: #0000FF;">Path</span> <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> <span style="color: #000000;">System.<span style="color: #0000FF;">IO</span></span><span style="color: #008000;">.</span><span style="color: #0000FF;">DirectoryInfo</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">@&quot;D:\wss\VirtualDirectories\yoursite.com&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
          <span style="color: #008080; font-style: italic;">//Call the Update method of the web application</span>
          site<span style="color: #008000;">.</span><span style="color: #0000FF;">WebApplication</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Update</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #008000;">&#125;</span>
      <span style="color: #008000;">&#125;</span>
      <span style="color: #0600FF; font-weight: bold;">catch</span> <span style="color: #008000;">&#40;</span>Exception ex<span style="color: #008000;">&#41;</span>
      <span style="color: #008000;">&#123;</span>
        Console<span style="color: #008000;">.</span><span style="color: #0000FF;">WriteLine</span><span style="color: #008000;">&#40;</span>ex<span style="color: #008000;">.</span><span style="color: #0000FF;">Message</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        Console<span style="color: #008000;">.</span><span style="color: #0000FF;">ReadLine</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
      <span style="color: #008000;">&#125;</span>
    <span style="color: #008000;">&#125;</span>
  <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p><strong>Option 2: PowerShell Script</strong></p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #000000;">&#91;</span><span style="color: #008080;">System.Reflection.Assembly</span><span style="color: #000000;">&#93;</span>::<span style="color: #800000;">LoadWithPartialName</span><span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;Microsoft.SharePoint&quot;</span><span style="color: #000000;">&#41;</span>
&nbsp;
<span style="color: #008000;">#Point to the site your web application hosts to grab a reference to the web application</span>
<span style="color: #800080;">$SPSite</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">new-object</span> Microsoft.SharePoint.SPSite<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;http://yoursite.com&quot;</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$WebApp</span> <span style="color: pink;">=</span> <span style="color: #800080;">$SPSite</span>.WebApplication
&nbsp;
<span style="color: #008000;">#Change SPUrlZone if not in default zone</span>
<span style="color: #800080;">$IISSettings</span> <span style="color: pink;">=</span> <span style="color: #800080;">$WebApp</span>.IisSettings<span style="color: #000000;">&#91;</span><span style="color: #000000;">&#91;</span>Microsoft.SharePoint.Administration.SPUrlZone<span style="color: #000000;">&#93;</span>::Default<span style="color: #000000;">&#93;</span>
&nbsp;
<span style="color: #008000;">#Point to your new directory</span>
<span style="color: #800080;">$IISSettings</span>.Path <span style="color: pink;">=</span> <span style="color: #800000;">&quot;D:\wss\VirtualDirectories\yoursite.com&quot;</span>
&nbsp;
<span style="color: #008000;">#Update Web Application</span>
<span style="color: #800080;">$WebApp</span>.Update<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$SPSite</span>.Dispose<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></pre></div></div>

<p>I hope this has been helpful, and as always, thank you for reading.</p>
<p>Cheers.</p>

<div class="sociable">
<div class="sociable_tagline">
<p><strong>Share this post:</strong></p>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="mailto:?subject=How%20to%20Change%20the%20IIS%20Path%20for%20a%20SharePoint%20Web%20Application&amp;body=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2009%2F02%2F26%2Fhow-to-change-the-iis-path-for-a-sharepoint-web-application%2F" title="email"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=How%20to%20Change%20the%20IIS%20Path%20for%20a%20SharePoint%20Web%20Application%20-%20http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2009%2F02%2F26%2Fhow-to-change-the-iis-path-for-a-sharepoint-web-application%2F" title="Twitter"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2009%2F02%2F26%2Fhow-to-change-the-iis-path-for-a-sharepoint-web-application%2F&amp;t=How%20to%20Change%20the%20IIS%20Path%20for%20a%20SharePoint%20Web%20Application" title="Facebook"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2009%2F02%2F26%2Fhow-to-change-the-iis-path-for-a-sharepoint-web-application%2F&amp;title=How%20to%20Change%20the%20IIS%20Path%20for%20a%20SharePoint%20Web%20Application&amp;notes=When%20creating%20a%20new%20web%20application%20in%20SharePoint%2C%20you%20choose%20the%20physical%20location%20of%20where%20the%20IIS%20website%20will%20be%20created.%20Once%20the%20application%20is%20born%2C%20however%2C%20there%20is%20no%20longer%20an%20option%20to%20change%20this%20path%20in%20Central%20Administration.%20You%20can%20v" title="del.icio.us"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2009%2F02%2F26%2Fhow-to-change-the-iis-path-for-a-sharepoint-web-application%2F&amp;title=How%20to%20Change%20the%20IIS%20Path%20for%20a%20SharePoint%20Web%20Application&amp;bodytext=When%20creating%20a%20new%20web%20application%20in%20SharePoint%2C%20you%20choose%20the%20physical%20location%20of%20where%20the%20IIS%20website%20will%20be%20created.%20Once%20the%20application%20is%20born%2C%20however%2C%20there%20is%20no%20longer%20an%20option%20to%20change%20this%20path%20in%20Central%20Administration.%20You%20can%20v" title="Digg"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2009%2F02%2F26%2Fhow-to-change-the-iis-path-for-a-sharepoint-web-application%2F&amp;title=How%20to%20Change%20the%20IIS%20Path%20for%20a%20SharePoint%20Web%20Application&amp;annotation=When%20creating%20a%20new%20web%20application%20in%20SharePoint%2C%20you%20choose%20the%20physical%20location%20of%20where%20the%20IIS%20website%20will%20be%20created.%20Once%20the%20application%20is%20born%2C%20however%2C%20there%20is%20no%20longer%20an%20option%20to%20change%20this%20path%20in%20Central%20Administration.%20You%20can%20v" title="Google Bookmarks"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2009%2F02%2F26%2Fhow-to-change-the-iis-path-for-a-sharepoint-web-application%2F&amp;title=How%20to%20Change%20the%20IIS%20Path%20for%20a%20SharePoint%20Web%20Application" title="StumbleUpon"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.mattjimison.com/blog/2009/02/26/how-to-change-the-iis-path-for-a-sharepoint-web-application/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>What this Blog Might Do</title>
		<link>http://www.mattjimison.com/blog/2009/02/24/what-this-blog-wont-do/</link>
		<comments>http://www.mattjimison.com/blog/2009/02/24/what-this-blog-wont-do/#comments</comments>
		<pubDate>Tue, 24 Feb 2009 19:25:26 +0000</pubDate>
		<dc:creator>mjimison</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[SharePoint]]></category>

		<guid isPermaLink="false">http://www.mattjimison.com/blog/?p=6</guid>
		<description><![CDATA[Being in web development for over 5 years, I often wonder why its taken me so long to start a blog. The answer is simple, though: greed I&#8217;ve been spending my time reading great blogs. I&#8217;ve been far more concerned with trying to pick something up, than to put something out. However, there have been [...]]]></description>
			<content:encoded><![CDATA[<p>Being in web development for over 5 years, I often wonder why its taken me so long to start a blog.</p>
<p>The answer is simple, though: <strong>greed</strong></p>
<p>I&#8217;ve been spending my time reading great blogs. I&#8217;ve been far more concerned with trying to pick something up, than to put something out. However, there have been many times I&#8217;ve found a &#8216;starting point&#8217; that had 60-70% of what I needed, but not everything. With SharePoint development gaining momentum, I thought a new blog would be a good opportunity to:</p>
<ol>
<li> Expand on ideas initially presented on other blogs</li>
<li>Share solutions I&#8217;ve come up with on projects related to my work at <a href="http://www.inin.com/" target="_blank">Interactive Intelligence</a></li>
<li>Wrap things up into solutions that non-developers will feel comfortable deploying</li>
</ol>
<p>I&#8217;ve got experience in other technologies related to web development, and so from time to time, when appropriate, I may branch away from SharePoint to hit up related topics such as C#, ASP.Net, JavaScript, CSS, and more. However, my goal here is to just put meat on the table to serve up for consumption. I&#8217;ve got a good list of starting topics, and so I&#8217;m excited to start getting to it.</p>
<p>Cheers.</p>

<div class="sociable">
<div class="sociable_tagline">
<p><strong>Share this post:</strong></p>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="mailto:?subject=What%20this%20Blog%20Might%20Do&amp;body=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2009%2F02%2F24%2Fwhat-this-blog-wont-do%2F" title="email"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=What%20this%20Blog%20Might%20Do%20-%20http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2009%2F02%2F24%2Fwhat-this-blog-wont-do%2F" title="Twitter"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2009%2F02%2F24%2Fwhat-this-blog-wont-do%2F&amp;t=What%20this%20Blog%20Might%20Do" title="Facebook"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2009%2F02%2F24%2Fwhat-this-blog-wont-do%2F&amp;title=What%20this%20Blog%20Might%20Do&amp;notes=Being%20in%20web%20development%20for%20over%205%20years%2C%20I%20often%20wonder%20why%20its%20taken%20me%20so%20long%20to%20start%20a%20blog.%0D%0A%0D%0AThe%20answer%20is%20simple%2C%20though%3A%20greed%0D%0A%0D%0AI%27ve%20been%20spending%20my%20time%20reading%20great%20blogs.%20I%27ve%20been%20far%20more%20concerned%20with%20trying%20to%20pick%20something%20u" title="del.icio.us"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2009%2F02%2F24%2Fwhat-this-blog-wont-do%2F&amp;title=What%20this%20Blog%20Might%20Do&amp;bodytext=Being%20in%20web%20development%20for%20over%205%20years%2C%20I%20often%20wonder%20why%20its%20taken%20me%20so%20long%20to%20start%20a%20blog.%0D%0A%0D%0AThe%20answer%20is%20simple%2C%20though%3A%20greed%0D%0A%0D%0AI%27ve%20been%20spending%20my%20time%20reading%20great%20blogs.%20I%27ve%20been%20far%20more%20concerned%20with%20trying%20to%20pick%20something%20u" title="Digg"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2009%2F02%2F24%2Fwhat-this-blog-wont-do%2F&amp;title=What%20this%20Blog%20Might%20Do&amp;annotation=Being%20in%20web%20development%20for%20over%205%20years%2C%20I%20often%20wonder%20why%20its%20taken%20me%20so%20long%20to%20start%20a%20blog.%0D%0A%0D%0AThe%20answer%20is%20simple%2C%20though%3A%20greed%0D%0A%0D%0AI%27ve%20been%20spending%20my%20time%20reading%20great%20blogs.%20I%27ve%20been%20far%20more%20concerned%20with%20trying%20to%20pick%20something%20u" title="Google Bookmarks"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.mattjimison.com%2Fblog%2F2009%2F02%2F24%2Fwhat-this-blog-wont-do%2F&amp;title=What%20this%20Blog%20Might%20Do" title="StumbleUpon"><img src="http://www.mattjimison.com/blog/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.mattjimison.com/blog/2009/02/24/what-this-blog-wont-do/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

