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

<channel>
	<title>Rob Garrett - Blog &#187; Microsoft SharePoint</title>
	<atom:link href="http://blog.robgarrett.com/tag/microsoft-sharepoint/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.robgarrett.com</link>
	<description>Software and Technology Tid-bits</description>
	<lastBuildDate>Fri, 03 Feb 2012 21:52:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='blog.robgarrett.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://0.gravatar.com/blavatar/aab8ef1df0f0164f4c766c98b644e9fb?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>Rob Garrett - Blog &#187; Microsoft SharePoint</title>
		<link>http://blog.robgarrett.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://blog.robgarrett.com/osd.xml" title="Rob Garrett - Blog" />
	<atom:link rel='hub' href='http://blog.robgarrett.com/?pushpress=hub'/>
		<item>
		<title>How to change a Page Layout Associated Content Type Id Programmatically</title>
		<link>http://blog.robgarrett.com/2011/11/03/how-to-change-a-page-layout-associated-content-type-id/</link>
		<comments>http://blog.robgarrett.com/2011/11/03/how-to-change-a-page-layout-associated-content-type-id/#comments</comments>
		<pubDate>Thu, 03 Nov 2011 21:03:05 +0000</pubDate>
		<dc:creator>Rob Garrett</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Microsoft SharePoint]]></category>

		<guid isPermaLink="false">https://robgarrett.wordpress.com/2011/11/03/how-to-change-a-page-layout-associated-content-type-id/</guid>
		<description><![CDATA[I developed some code that uploads a new page layout file (ASPX) from disk to the Master Page Gallery of a site collection.&#160; I wanted to associate the uploaded publishing page with an existing content type, such as the “Welcome Page” content type.&#160; This is equivalent to editing the properties of the page layout and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.robgarrett.com&amp;blog=7688126&amp;post=4392&amp;subd=robgarrett&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I developed some code that uploads a new page layout file (ASPX) from disk to the Master Page Gallery of a site collection.&#160; I wanted to associate the uploaded publishing page with an existing content type, such as the “Welcome Page” content type.&#160; This is equivalent to editing the properties of the page layout and setting the “<strong>Associated Content Type</strong>” property…</p>
<p>&#160;</p>
<p><a href="http://robgarrett.files.wordpress.com/2011/11/image.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://robgarrett.files.wordpress.com/2011/11/image_thumb.png?w=477&#038;h=114" width="477" height="114" /></a></p>
<p>&#160;</p>
<p>Setting the Associated Content Type property in code is not as easy as thought.&#160; After trawling around the web for an hour, I found no good example.&#160; I found plenty of examples to create a Page Layout declaratively in XML and assign the associated content property, but no examples in C# for an existing SPFile object.&#160; Then it hit me…</p>
<p>The <strong>PublishingAssociatedContentType</strong> property expects a formatted string that contains both the display name and the content type ID.&#160; So, armed with both an SPFile object that is the page layout file and an SPContentType object, I was able to associate the page layout with the following code:</p>
<p><strong>file.Item.Properties[&quot;PublishingAssociatedContentType&quot;] = String.Format(&quot;;#{0};#{1};#&quot;, spCT.Name, spCT.Id.ToString());</strong></p>
<p>Make sure to call file.Item.Update();</p>
<p>Wham!</p>
<br /> Tagged: <a href='http://blog.robgarrett.com/tag/microsoft-sharepoint/'>Microsoft SharePoint</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/robgarrett.wordpress.com/4392/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/robgarrett.wordpress.com/4392/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/robgarrett.wordpress.com/4392/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/robgarrett.wordpress.com/4392/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/robgarrett.wordpress.com/4392/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/robgarrett.wordpress.com/4392/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/robgarrett.wordpress.com/4392/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/robgarrett.wordpress.com/4392/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/robgarrett.wordpress.com/4392/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/robgarrett.wordpress.com/4392/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/robgarrett.wordpress.com/4392/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/robgarrett.wordpress.com/4392/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/robgarrett.wordpress.com/4392/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/robgarrett.wordpress.com/4392/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.robgarrett.com&amp;blog=7688126&amp;post=4392&amp;subd=robgarrett&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.robgarrett.com/2011/11/03/how-to-change-a-page-layout-associated-content-type-id/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Rob Garrett</media:title>
		</media:content>

		<media:content url="http://robgarrett.files.wordpress.com/2011/11/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>Site Collection URL in a User Control</title>
		<link>http://blog.robgarrett.com/2009/12/15/site-collection-url-in-a-user-control/</link>
		<comments>http://blog.robgarrett.com/2009/12/15/site-collection-url-in-a-user-control/#comments</comments>
		<pubDate>Tue, 15 Dec 2009 17:46:00 +0000</pubDate>
		<dc:creator>Rob Garrett</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Microsoft SharePoint]]></category>

		<guid isPermaLink="false">http://robgarrett.wordpress.com/2009/12/15/site-collection-url-in-a-user-control/</guid>
		<description><![CDATA[Ever have a problem remembering something small, I do.&#160; No matter how many projects I develop in SharePoint I cannot seem to remember how to reference the site collection URL from a user control.&#160; So, after digging around for 5 minutes to find the answer I decided to blog it and save my aging memory: [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.robgarrett.com&amp;blog=7688126&amp;post=4370&amp;subd=robgarrett&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Ever have a problem remembering something small, I do.&#160; No matter how many projects I develop in SharePoint I cannot seem to remember how to reference the site collection URL from a user control.&#160; So, after digging around for 5 minutes to find the answer I decided to blog it and save my aging memory:</p>
<p>&lt;%$SPUrl:~SiteCollection/ %&gt;</p>
<br /> Tagged: Microsoft SharePoint <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/robgarrett.wordpress.com/4370/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/robgarrett.wordpress.com/4370/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/robgarrett.wordpress.com/4370/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/robgarrett.wordpress.com/4370/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/robgarrett.wordpress.com/4370/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/robgarrett.wordpress.com/4370/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/robgarrett.wordpress.com/4370/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/robgarrett.wordpress.com/4370/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/robgarrett.wordpress.com/4370/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/robgarrett.wordpress.com/4370/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/robgarrett.wordpress.com/4370/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/robgarrett.wordpress.com/4370/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/robgarrett.wordpress.com/4370/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/robgarrett.wordpress.com/4370/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.robgarrett.com&amp;blog=7688126&amp;post=4370&amp;subd=robgarrett&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.robgarrett.com/2009/12/15/site-collection-url-in-a-user-control/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Rob Garrett</media:title>
		</media:content>
	</item>
		<item>
		<title>Site Collection Restore Error</title>
		<link>http://blog.robgarrett.com/2009/09/20/site-collection-restore-error/</link>
		<comments>http://blog.robgarrett.com/2009/09/20/site-collection-restore-error/#comments</comments>
		<pubDate>Mon, 21 Sep 2009 01:20:21 +0000</pubDate>
		<dc:creator>Rob Garrett</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[Microsoft SharePoint]]></category>

		<guid isPermaLink="false">http://robgarrett.wordpress.com/2009/09/20/site-collection-restore-error/</guid>
		<description><![CDATA[If you ever run into the following error when performing a site collection restore, via STSADM, and you know space is not an issue, try the steps below before diving deep into troubleshooting mode: “The site collection could not be restored. If this problem persists, please make sure the content databases are available and have [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.robgarrett.com&amp;blog=7688126&amp;post=4351&amp;subd=robgarrett&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you ever run into the following error when performing a site collection restore, via STSADM, and you know space is not an issue, try the steps below before diving deep into troubleshooting mode:</p>
<p>“<strong>The site collection could not be restored. If this problem persists, please make sure the content databases are available and have sufficient free space.</strong>”</p>
<ul>
<li>Stop and start the SharePoint Timer Service</li>
<li>IISRESET</li>
<li>Restore to a new content database</li>
</ul>
<br /> Tagged: Microsoft SharePoint <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/robgarrett.wordpress.com/4351/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/robgarrett.wordpress.com/4351/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/robgarrett.wordpress.com/4351/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/robgarrett.wordpress.com/4351/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/robgarrett.wordpress.com/4351/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/robgarrett.wordpress.com/4351/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/robgarrett.wordpress.com/4351/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/robgarrett.wordpress.com/4351/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/robgarrett.wordpress.com/4351/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/robgarrett.wordpress.com/4351/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/robgarrett.wordpress.com/4351/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/robgarrett.wordpress.com/4351/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/robgarrett.wordpress.com/4351/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/robgarrett.wordpress.com/4351/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.robgarrett.com&amp;blog=7688126&amp;post=4351&amp;subd=robgarrett&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.robgarrett.com/2009/09/20/site-collection-restore-error/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Rob Garrett</media:title>
		</media:content>
	</item>
		<item>
		<title>Top SharePoint</title>
		<link>http://blog.robgarrett.com/2009/08/03/top-sharepoint/</link>
		<comments>http://blog.robgarrett.com/2009/08/03/top-sharepoint/#comments</comments>
		<pubDate>Mon, 03 Aug 2009 20:33:19 +0000</pubDate>
		<dc:creator>Rob Garrett</dc:creator>
				<category><![CDATA[Web Sites]]></category>
		<category><![CDATA[Microsoft SharePoint]]></category>

		<guid isPermaLink="false">http://robgarrett.wordpress.com/2009/08/03/top-sharepoint/</guid>
		<description><![CDATA[Check out http://www.topsharepoint.com for the latest and greatest list of sites implemented on the SharePoint platform.&#160; A number of the sites listed were implemented by my current employer – Portal Solutions – who are also listed because our site is hosted in SharePoint.&#160; A couple of the sites were managed and architected by yours truly [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.robgarrett.com&amp;blog=7688126&amp;post=4341&amp;subd=robgarrett&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Check out <a href="http://www.topsharepoint.com">http://www.topsharepoint.com</a> for the latest and greatest list of sites implemented on the SharePoint platform.&#160; </p>
<p>A number of the sites listed were implemented by my current <a href="http://www.topsharepoint.com/portal-solutions" target="_blank">employer</a> – Portal Solutions – who are also listed because our site is hosted in SharePoint.&#160; A couple of the sites were managed and architected by yours truly :)</p>
<p><em>“TopSharepoint.com showcases some of the world’s best designed SharePoint based web sites from around the world. We carefully select SharePoint web sites based on their usability, design, creativity and ability to incorporate modern techniques. Anyone can submit a SharePoint web site for free and the only requirements we ask for is that your web site is built on SharePoint platform, well designed and original. So, if you developed, or found a SharePoint web site that might meet the above requirements we want to know about it! Please go ahead and </em><a href="http://www.topsharepoint.com/submit"><em>submit your website</em></a><em> to the TopSharepoint showcase gallery.”</em></p>
<p>Here’s my offspring, listed in the top 5:</p>
<p><a title="http://www.topsharepoint.com/?s=conservation" href="http://www.topsharepoint.com/?s=conservation">http://www.topsharepoint.com/?s=conservation</a></p>
<br /> Tagged: Microsoft SharePoint <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/robgarrett.wordpress.com/4341/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/robgarrett.wordpress.com/4341/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/robgarrett.wordpress.com/4341/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/robgarrett.wordpress.com/4341/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/robgarrett.wordpress.com/4341/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/robgarrett.wordpress.com/4341/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/robgarrett.wordpress.com/4341/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/robgarrett.wordpress.com/4341/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/robgarrett.wordpress.com/4341/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/robgarrett.wordpress.com/4341/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/robgarrett.wordpress.com/4341/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/robgarrett.wordpress.com/4341/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/robgarrett.wordpress.com/4341/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/robgarrett.wordpress.com/4341/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.robgarrett.com&amp;blog=7688126&amp;post=4341&amp;subd=robgarrett&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.robgarrett.com/2009/08/03/top-sharepoint/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Rob Garrett</media:title>
		</media:content>
	</item>
		<item>
		<title>Efficient way to add a new item to a SharePoint list</title>
		<link>http://blog.robgarrett.com/2009/02/25/efficient-way-to-add-a-new-item-to-a-sharepoint-list/</link>
		<comments>http://blog.robgarrett.com/2009/02/25/efficient-way-to-add-a-new-item-to-a-sharepoint-list/#comments</comments>
		<pubDate>Wed, 25 Feb 2009 22:01:00 +0000</pubDate>
		<dc:creator>Rob Garrett</dc:creator>
				<category><![CDATA[Everything]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Microsoft SharePoint]]></category>

		<guid isPermaLink="false">/cs/blogs/software/archive/2009/02/25/efficient-way-to-add-a-new-item-to-a-sharepoint-list.aspx</guid>
		<description><![CDATA[Never use SPList.Items.Add because this approach gets all items in the list before adding a new SPListItem.&#160; Use the following method instead, which does not preload the list items: 1: /// &#60;summary&#62; 2: /// More efficient way of adding an item to a list. 3: /// &#60;/summary&#62; 4: /// &#60;remarks&#62; 5: /// GetItems with a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.robgarrett.com&amp;blog=7688126&amp;post=3186&amp;subd=robgarrett&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Never use SPList.Items.Add because this approach gets all items in the list before adding a new SPListItem.&nbsp; Use the following method instead, which does not preload the list items:</p>
<div class="csharpcode">
<pre class="alt"><span class="lnum">   1:  </span><span class="rem">/// &lt;summary&gt;</span></pre>
<pre><span class="lnum">   2:  </span>        <span class="rem">/// More efficient way of adding an item to a list.</span></pre>
<pre class="alt"><span class="lnum">   3:  </span>        <span class="rem">/// &lt;/summary&gt;</span></pre>
<pre><span class="lnum">   4:  </span>        <span class="rem">/// &lt;remarks&gt;</span></pre>
<pre class="alt"><span class="lnum">   5:  </span>        <span class="rem">/// GetItems with a query is faster than calling the OM to get all items.</span></pre>
<pre><span class="lnum">   6:  </span>        <span class="rem">/// This is because the SPListItemCollection is created without loading all the</span></pre>
<pre class="alt"><span class="lnum">   7:  </span>        <span class="rem">/// data until the first query request.  Whereas SPList.Items loads all the data</span></pre>
<pre><span class="lnum">   8:  </span>        <span class="rem">/// at construction.</span></pre>
<pre class="alt"><span class="lnum">   9:  </span>        <span class="rem">/// &lt;/remarks&gt;</span></pre>
<pre><span class="lnum">  10:  </span>        <span class="rem">/// &lt;param name=&quot;list&quot;&gt;List.&lt;/param&gt;</span></pre>
<pre class="alt"><span class="lnum">  11:  </span>        <span class="rem">/// &lt;returns&gt;List Item Added.&lt;/returns&gt;</span></pre>
<pre><span class="lnum">  12:  </span>        <span class="kwrd">public</span> <span class="kwrd">static</span> SPListItem OptimizedAddItem(SPList list)</pre>
<pre class="alt"><span class="lnum">  13:  </span>        {</pre>
<pre><span class="lnum">  14:  </span>            <span class="kwrd">const</span> <span class="kwrd">string</span> EmptyQuery = <span class="str">&quot;0&quot;</span>;</pre>
<pre class="alt"><span class="lnum">  15:  </span>            SPQuery q = <span class="kwrd">new</span> SPQuery {Query = EmptyQuery};</pre>
<pre><span class="lnum">  16:  </span>            <span class="kwrd">return</span> list.GetItems(q).Add();</pre>
<pre class="alt"><span class="lnum">  17:  </span>        }</pre>
</div>
<br /> Tagged: Microsoft SharePoint <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/robgarrett.wordpress.com/3186/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/robgarrett.wordpress.com/3186/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/robgarrett.wordpress.com/3186/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/robgarrett.wordpress.com/3186/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/robgarrett.wordpress.com/3186/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/robgarrett.wordpress.com/3186/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/robgarrett.wordpress.com/3186/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/robgarrett.wordpress.com/3186/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/robgarrett.wordpress.com/3186/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/robgarrett.wordpress.com/3186/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/robgarrett.wordpress.com/3186/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/robgarrett.wordpress.com/3186/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/robgarrett.wordpress.com/3186/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/robgarrett.wordpress.com/3186/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.robgarrett.com&amp;blog=7688126&amp;post=3186&amp;subd=robgarrett&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.robgarrett.com/2009/02/25/efficient-way-to-add-a-new-item-to-a-sharepoint-list/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Rob Garrett</media:title>
		</media:content>
	</item>
		<item>
		<title>SharePoint Development Best Practices (Summary)</title>
		<link>http://blog.robgarrett.com/2009/02/20/sharepoint-development-best-practices-summary/</link>
		<comments>http://blog.robgarrett.com/2009/02/20/sharepoint-development-best-practices-summary/#comments</comments>
		<pubDate>Sat, 21 Feb 2009 02:42:00 +0000</pubDate>
		<dc:creator>Rob Garrett</dc:creator>
				<category><![CDATA[Everything]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Microsoft SharePoint]]></category>

		<guid isPermaLink="false">/cs/blogs/software/archive/2009/02/20/sharepoint-development-best-practices-summary.aspx</guid>
		<description><![CDATA[I&#8217;ve read several blog posts of late regarding best practices for developing SharePoint API based components.&#160; Some developers are aware of issues surrounding disposal of SPSite and SPWeb objects and the use of SPList Item collections, and some are not.&#160; The simple fact is the SharePoint API is not intuitive when it comes usage of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.robgarrett.com&amp;blog=7688126&amp;post=3180&amp;subd=robgarrett&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&rsquo;ve read several blog posts of late regarding best practices for developing SharePoint API based components.&nbsp; Some developers are aware of issues surrounding disposal of SPSite and SPWeb objects and the use of SPList Item collections, and some are not.&nbsp; The simple fact is the SharePoint API is not intuitive when it comes usage of memory hungry-object instances, and it is all too easy to leave too many of these objects in memory for the garbage collector to deal with &ndash; causing large memory spikes in the site application pool with high traffic utilization.&nbsp; Furthermore, what seems like innocent well structured code can perform badly because of the underlying calls against the SharePoint content databases.&nbsp; This blog post serves as a reference point and as a quick summary of some of the best practices.</p>
<p><strong><font size="3">Best Practices: Using Disposable Windows SharePoint Services Objects</font></strong></p>
<p><a href="http://msdn.microsoft.com/en-us/library/aa973248.aspx" target="_blank">Reference</a></p>
<p>Enable the following registry setting to populate the ULS logs with allocation identifiers to isolate non-disposed SPSite and SPWeb objects:    <br />
<em>HKEY_LOCAL_MACHINESOFTWAREMicrosoftShared ToolsWeb Server ExtensionsHeapSettings SPRequestStackTrace = 1</em></p>
<p>Wrap all calls that create a new SPSite or SPWeb object (except those from obtained from the SPContext.Current singleton) in try, catch, finally blocks, or using statements    
</p>
<p><strong>SPContext</strong> objects are managed by the SharePoint framework and should not be explicitly disposed in your code. This is true also for the <strong>SPSite</strong> and <strong>SPWeb</strong> objects returned by <strong>SPContext.Site</strong>, <strong>SPContext.Current.Site</strong>, <strong>SPContext.Web</strong>, and <strong>SPContext.Current.Web</strong>.</p>
<p>You must be cautious and aware of what the runtime is doing whenever you combine SharePoint object model calls on the same line. Leaks arising from this scenario are among the hardest to find.</p>
<p>The <strong>finally</strong> block executes after calls to <strong>Response.Redirect</strong> in the <strong>try</strong> block. <strong>Response.Redirect</strong> ultimately generates a ThreadAbortException. When this exception is raised, the runtime executes all <strong>finally</strong> blocks before ending the thread. However, because the <strong>finally</strong> block can do an unbounded computation or cancel the <strong>ThreadAbortException</strong>, there is no guarantee that the thread will end. Therefore, before any redirection or transfer of processing can occur, you must dispose of the objects. If your code must redirect, implement it in a way similar to the following code example.</p>
<blockquote>
<pre class="csharpcode">String str;
SPSite oSPSite = <span class="kwrd">null</span>;
SPWeb oSPWeb = <span class="kwrd">null</span>;

<span class="kwrd">try</span>
{
   oSPSite = <span class="kwrd">new</span> SPSite(<span class="str">&quot;http://server&quot;</span>);
   oSPWeb = oSPSite.OpenWeb(..);

   str = oSPWeb.Title;
   <span class="kwrd">if</span>(bDoRedirection)
   {
       <span class="kwrd">if</span> (oSPWeb != <span class="kwrd">null</span>)
          oSPWeb.Dispose();

       <span class="kwrd">if</span> (oSPSite != <span class="kwrd">null</span>)
          oSPSite.Dispose();

       Response.Redirect(<span class="str">&quot;newpage.aspx&quot;</span>);
   }
}
<span class="kwrd">catch</span>(Exception e)
{
}
<span class="kwrd">finally</span>
{
   <span class="kwrd">if</span> (oSPWeb != <span class="kwrd">null</span>)
     oSPWeb.Dispose();

   <span class="kwrd">if</span> (oSPSite != <span class="kwrd">null</span>)
      oSPSite.Dispose();
}</pre>
</blockquote>
<p>&nbsp;</p>
<p>Good practices to reduce object long-term retention:</p>
<ul>
<li>If you create the object with a <strong>new</strong> operator, ensure that the creating application disposes of it. </li>
<li>Dispose of items created by SharePoint methods that return other <strong>SPWeb</strong> objects (such as <strong>OpenWeb</strong>). </li>
<li>Do not share any <strong>SPRequest</strong> object (and by extension any object that contains a reference to an <strong>SPRequest</strong> object) across threads. </li>
</ul>
<p>SPSite Object:</p>
<ul>
<li>The <strong>SPSiteCollection.Add</strong> method creates and returns a new <strong>SPSite</strong> object. You should dispose of any <strong>SPSite</strong> object returned from the <strong>SPSiteCollection.Add</strong> method. </li>
<li>The <strong>SPSiteCollection []</strong> index operator returns a new <strong>SPSite</strong> object for each access. An <strong>SPSite</strong> instance is created even if that object was already accessed. The following code samples demonstrate improper disposal of the <strong>SPSite</strong> object. </li>
<li>The <strong>SPSite.AllWebs.Add</strong> method creates and returns an <strong>SPWeb</strong> object. You should dispose of any <strong>SPWeb</strong> object returned from <strong>SPSite.AllWebs.Add</strong>. </li>
<li>The <strong>SPWebCollection.Add</strong> method creates and returns an <strong>SPWeb</strong> object that needs to be disposed. </li>
<li>The <strong>SPSite.AllWebs []</strong> index operator returns a new <strong>SPWeb</strong> instance each time it is accessed. </li>
<li>The <strong>OpenWeb</strong> method and SelfServiceCreateSite method (all signatures) create an <strong>SPWeb</strong> object and return it to the caller. </li>
<li>The <strong>Microsoft.Office.Server.UserProfiles.PersonalSite</strong> returns an <strong>SPSite</strong> object that must be disposed. </li>
</ul>
<h5><font color="#ff0000">SPSite.RootWeb Property</font></h5>
<p><font color="#ff0000">An earlier version of this article indicated that the calling application should dispose of the SPSite.RootWeb property just before disposing of the SPSite object that is using it. This is no longer the official guidance. The dispose cleanup is handled automatically by the SharePoint framework. Additionally, SPSite properties LockIssue, Owner, and SecondaryContact used the RootWeb property internally. Given the updated guidance for RootWeb, it is no longer advisable to call the Dispose method on the SPSite.RootWeb property whenever any of these properties are used.</font></p>
<p>SPWeb Object:</p>
<ul>
<li>The <strong>SPWeb.Webs</strong> property returns an <strong>SPWebCollection</strong> object. The <strong>SPWeb</strong> objects in this collection must be disposed. </li>
<li>The <strong>SPWeb.Webs.Add</strong> method (or Add) creates and returns a new <strong>SPWeb</strong> object. You should dispose of any <strong>SPWeb</strong> object returned from this method call. </li>
<li>The <strong>SPWeb.Webs[]</strong> index operator returns a new <strong>SPWeb</strong> object for each access </li>
</ul>
<h5><font color="#ff0000">SPWeb.ParentWeb Property</font></h5>
<p><strong><font color="#ff0000">Updated Guidance</font></strong></p>
<p><font color="#ff0000">An earlier version of this article recommended that the calling application should dispose of the <strong>SPWeb.ParentWeb</strong>. This is no longer the official guidance. The dispose cleanup is handled automatically by the SharePoint framework.</font></p>
<p>Other Objects:</p>
<ul>
<li>Microsoft.SharePoint.Portal.SiteData.Area.Web Property.&nbsp; The <strong>Web</strong> property returns a new <strong>SPWeb</strong> object each time it is accessed. </li>
<li>If the object is obtained from the SharePoint context objects (<strong>GetContextSite</strong> method and GetContextWeb method), the calling application should <em>not</em> call the <strong>Dispose</strong> method on the object. </li>
<li>The <strong>SPLimitedWebPartManager</strong> class contains a reference to an internal <strong>SPWeb</strong> object that must be disposed. </li>
<li>The <strong>GetPublishingWebs</strong> method of the <strong>PublishingWeb</strong> class returns a <strong>PublishingWebCollection</strong> object. You must call the <strong>Close</strong> method on each enumerated <strong>innerPubWeb</strong> object. When you are calling only the <strong>GetPublishingWeb</strong> method, you are not required to call <strong>Close</strong>. </li>
<li>The <strong>Microsoft.SharePoint.Publishing.PublishingWeb.GetVariation</strong> method returns a <strong>PublishingWeb</strong> object that must be disposed. </li>
</ul>
<p><strong><font size="3">Best Practices: Common Coding Issues When Using the SharePoint Object Model</font></strong></p>
<p><a href="//msdn.microsoft.com/en-us/library/bb687949.aspx" target="_blank">Reference</a></p>
<h5><strong>Caching Data and Objects</strong></h5>
<p>Many developers use the Microsoft .NET Framework caching objects (for example, <strong>System.Web.Caching.Cache</strong>) to help take better advantage of memory and increase overall system performance. But many objects are not &quot;thread safe&quot; and caching those objects can cause applications to fail and unexpected or unrelated user errors. </p>
<p><strong>Caching SharePoint Objects That Are Not Thread Safe</strong></p>
<p>You might try to increase performance and memory usage by caching <strong>SPListItemCollection </strong>objects that are returned from queries. In general, this is a good practice; however, the <strong>SPListItemCollection</strong> object contains an embedded <strong>SPWeb</strong> object that is not thread safe and should not be cached. </p>
<p>You can cache a <strong>DataTable</strong> object that is created from the <strong>SPListItemCollection</strong> object.</p>
<h5><strong>Using Objects in Event Receivers </strong></h5>
<p>Do not instantiate <strong>SPWeb</strong>, <strong>SPSite</strong>, <strong>SPList</strong>, or <strong>SPListItem</strong> objects within an event receiver. Event receivers that instantiate <strong>SPSite</strong>, <strong>SPWeb</strong>, <strong>SPList</strong>, or <strong>SPListItem</strong> objects instead of using the instances passed via the event properties can cause the following problems: </p>
<ul>
<li>They incur significant additional roundtrips to the database. (One write operation can result in up to five additional roundtrips in each event receiver.) </li>
<li>Calling the Update method on these instances can cause subsequent Update calls in other registered event receivers to fail. </li>
</ul>
<p><strong>Working with Folders and Lists</strong></p>
<p><strong>Do not use SPList.Items.&nbsp; SPList.Items</strong> selects all items from all subfolders, including all fields in the list.</p>
<ul>
<li>Instead of calling <strong>SPList.Items.Add</strong>, simply use <strong>SPList.AddItem</strong>. </li>
<li>Retrieve list items using <strong>SPList.GetItems(SPQuery query) </strong></li>
<li>Instead of using <strong>SPList.Items.GetItemById</strong>, use <strong>SPList.GetItemById(int id, string field1, params string[] fields)</strong> </li>
</ul>
<p>Do not enumerate entire <strong>SPList.Items</strong> collections or <strong>SPFolder.Files</strong> collections.</p>
<table border="1" cellpadding="2" cellspacing="0" width="776">
<tbody>
<tr>
<td valign="top" width="390"><strong>Poor Performing Methods and Properties</strong></td>
<td valign="top" width="384"><strong>Better Performing Alternatives</strong></td>
</tr>
<tr>
<td valign="top" width="390">SPList.Items.Count</td>
<td valign="top" width="384">SPList.ItemCount </td>
</tr>
<tr>
<td valign="top" width="390">SPList.Items.XmlDataSchema</td>
<td valign="top" width="384">Create an SPQuery object to retrieve items you want</td>
</tr>
<tr>
<td valign="top" width="390">SPList.Items.NumberOfFields</td>
<td valign="top" width="384">Create an SPQuery object (specifying the ViewFields)</td>
</tr>
<tr>
<td valign="top" width="390">SPList.Items[System.Guid]</td>
<td valign="top" width="384">SPList.GetItemByUniqueId(System.Guid)</td>
</tr>
<tr>
<td valign="top" width="390">SPList.Items[System.Int32]</td>
<td valign="top" width="384">SPList.GetItemById(System.Int32)</td>
</tr>
<tr>
<td valign="top" width="390">SPList.Items.ReorderItems</td>
<td valign="top" width="384">Perform a non-paged query using SPQuery in each page</td>
</tr>
<tr>
<td valign="top" width="390">SPList.Items.GetItemById(System.Int32)</td>
<td valign="top" width="384">SPList.GetItemById(System.Int32)</td>
</tr>
<tr>
<td valign="top" width="390">SPFolder.Files.Count</td>
<td valign="top" width="384">SPFolder.ItemCount</td>
</tr>
</tbody>
</table>
<p><font color="#ff0000">Use <strong>PortalSiteMapProvider</strong> (Microsoft Office SharePoint Server 2007 only).</font></p>
<p><font color="#ff0000">Steve Peschka&#39;s white paper </font><a href="http://go.microsoft.com/fwlink?LinkId=95450"><font color="#ff0000">Working with Large Lists in Office SharePoint Server 2007</font></a><font color="#ff0000"> describes an efficient approach to retrieving list data in Office SharePoint Server 2007 by using the <strong>PortalSiteMapProvider</strong> class.<br />
    <br />
(Very important as this works around the 2000 item limit)</font></p>
<p><strong>Scaling Code</strong></p>
<p>How to make this code more scalable or fine-tune it for a multiple user environment can be a hard question to answer. It depends on what the application is designed to do. </p>
<p>You should take the following into consideration when asking how to make code more scalable:</p>
<ul>
<li>
<p>Is the data static (seldom changes), somewhat static (changes occasionally), or dynamic (changes constantly)?</p>
</li>
<li>
<p>Is the data the same for all users, or does it change? For example, does it change depending on the user who is logged on, the part of the site being accessed, or the time of year (seasonal information)?</p>
</li>
<li>
<p>Is the data easily accessible or does it require a long time to return the data? For example, is it returning from a long-running database query or from remote databases that can have some network latency in the data transfers?</p>
</li>
<li>
<p>Is the data public or does it require a higher level of security?</p>
</li>
<li>
<p>What is the size of the data?</p>
</li>
<li>
<p>Is the SharePoint site on a single server or on a server farm?</p>
</li>
</ul>
<p><strong>Using SPQuery Objects</strong> </p>
<p>SPQuery objects can cause performance problems whenever they return large result sets. The following suggestions will help you optimize your code so that performance will not suffer greatly whenever your searches return large numbers of items.</p>
<ul>
<li>Do not use an unbounded <strong>SPQuery</strong> object. </li>
<li>An <strong>SPQuery</strong> object without a value for <strong>RowLimit</strong> will perform poorly and fail on large lists. Specify a <strong>RowLimit</strong> between 1 and 2000 and, if necessary, page through the list. </li>
<li>Use indexed fields. </li>
<li>If you query on a field that is not indexed, the query will be blocked whenever it would result in a scan of more items than the query threshold (as soon as there are more items in the list than are specified in the query threshold). Set <strong>SPQuery.RowLimit</strong> to a value that is less than the query threshold. </li>
<li>If you know the URL of your list item and want to query by <strong>FileRef</strong>, use <strong>SPWeb.GetListItem</strong>(string <strong>strUrl</strong>, string field1, <strong>params</strong> string[] fields) instead. </li>
</ul>
<br /> Tagged: Microsoft SharePoint <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/robgarrett.wordpress.com/3180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/robgarrett.wordpress.com/3180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/robgarrett.wordpress.com/3180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/robgarrett.wordpress.com/3180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/robgarrett.wordpress.com/3180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/robgarrett.wordpress.com/3180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/robgarrett.wordpress.com/3180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/robgarrett.wordpress.com/3180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/robgarrett.wordpress.com/3180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/robgarrett.wordpress.com/3180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/robgarrett.wordpress.com/3180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/robgarrett.wordpress.com/3180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/robgarrett.wordpress.com/3180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/robgarrett.wordpress.com/3180/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.robgarrett.com&amp;blog=7688126&amp;post=3180&amp;subd=robgarrett&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.robgarrett.com/2009/02/20/sharepoint-development-best-practices-summary/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Rob Garrett</media:title>
		</media:content>
	</item>
		<item>
		<title>Authentication failed because the remote party has closed the transport stream</title>
		<link>http://blog.robgarrett.com/2009/01/19/authentication-failed-because-the-remote-party-has-closed-the-transport-stream/</link>
		<comments>http://blog.robgarrett.com/2009/01/19/authentication-failed-because-the-remote-party-has-closed-the-transport-stream/#comments</comments>
		<pubDate>Mon, 19 Jan 2009 04:16:26 +0000</pubDate>
		<dc:creator>Rob Garrett</dc:creator>
				<category><![CDATA[Everything]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Microsoft SharePoint]]></category>

		<guid isPermaLink="false">/cs/blogs/software/archive/2009/01/18/authentication-failed-because-the-remote-party-has-closed-the-transport-stream.aspx</guid>
		<description><![CDATA[If you receiver the error &#34;Authentication failed because the remote party has closed the transport stream&#34; when accessing &#34;Search Settings&#34; in the SSP, the following steps will resolve the issue.&#160; The issue is a result of incorrect self-serving-certificate. 1. Install the IIS 6.0 Resource Kit on the index server (http://www.microsoft.com/downloads/details.aspx?FamilyID=56fc92ee-a71a-4c73-b628-ade629c89499&#38;DisplayLang=en) 2. Assign a new SSL [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.robgarrett.com&amp;blog=7688126&amp;post=3167&amp;subd=robgarrett&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you receiver the error &quot;Authentication failed because the remote party has closed the transport stream&quot; when accessing &quot;Search Settings&quot; in the SSP, the following steps will resolve the issue.&#160; The issue is a result of incorrect self-serving-certificate.</p>
<p>1. Install the IIS 6.0 Resource Kit on the index server (<a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=56fc92ee-a71a-4c73-b628-ade629c89499&amp;DisplayLang=en">http://www.microsoft.com/downloads/details.aspx?FamilyID=56fc92ee-a71a-4c73-b628-ade629c89499&amp;DisplayLang=en</a>)    <br />2. Assign a new SSL certificate&#160; to the Office SharePoint Server Web Services site <u>on the index server</u> using the <strong>SELFSSL</strong> tool from the resource kit. </p>
<p><strong>SELFSSL.EXE</strong> /N:CN=&lt;name of index server&gt; /K:1024 /V:&lt;number of days cert should be valid&gt; /S:951338967&#160; /P:56738    <br />The /S and /P parameters specify the web site ID and port number, respectively, of the Office SharePoint Server Web Services site in IIS. They should be set to the appropriate values for your environment.</p>
<br /> Tagged: Microsoft SharePoint <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/robgarrett.wordpress.com/3167/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/robgarrett.wordpress.com/3167/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/robgarrett.wordpress.com/3167/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/robgarrett.wordpress.com/3167/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/robgarrett.wordpress.com/3167/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/robgarrett.wordpress.com/3167/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/robgarrett.wordpress.com/3167/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/robgarrett.wordpress.com/3167/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/robgarrett.wordpress.com/3167/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/robgarrett.wordpress.com/3167/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/robgarrett.wordpress.com/3167/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/robgarrett.wordpress.com/3167/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/robgarrett.wordpress.com/3167/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/robgarrett.wordpress.com/3167/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.robgarrett.com&amp;blog=7688126&amp;post=3167&amp;subd=robgarrett&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.robgarrett.com/2009/01/19/authentication-failed-because-the-remote-party-has-closed-the-transport-stream/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Rob Garrett</media:title>
		</media:content>
	</item>
		<item>
		<title>Recycle IIS App Pool from Script</title>
		<link>http://blog.robgarrett.com/2008/11/07/recycle-iis-app-pool-from-script/</link>
		<comments>http://blog.robgarrett.com/2008/11/07/recycle-iis-app-pool-from-script/#comments</comments>
		<pubDate>Fri, 07 Nov 2008 18:13:12 +0000</pubDate>
		<dc:creator>Rob Garrett</dc:creator>
				<category><![CDATA[Everything]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Microsoft SharePoint]]></category>

		<guid isPermaLink="false">/cs/blogs/software/archive/2008/11/07/recycle-iis-app-pool-from-script.aspx</guid>
		<description><![CDATA[My colleague, Carlos Fernandez, sent me this CSCRIPT command for recycling the an IIS application pool: %windir%\system32\cscript.exe c:\windows\system32\iisapp.vbs /a &#34;SharePoint &#8211; 80&#34; /r Tired of manually recycling the app pool each time you make a code change to your SharePoint web part?&#160; No problem, add the following command to the post build events in Visual [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.robgarrett.com&amp;blog=7688126&amp;post=3124&amp;subd=robgarrett&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>My colleague, Carlos Fernandez, sent me this CSCRIPT command for recycling the an IIS application pool:</p>
<p>%windir%\system32\cscript.exe c:\windows\system32\iisapp.vbs /a &quot;SharePoint &#8211; 80&quot; /r</p>
<p>Tired of manually recycling the app pool each time you make a code change to your SharePoint web part?&#160; No problem, add the following command to the post build events in Visual Studio.</p>
<br /> Tagged: ASP.NET, Microsoft SharePoint <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/robgarrett.wordpress.com/3124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/robgarrett.wordpress.com/3124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/robgarrett.wordpress.com/3124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/robgarrett.wordpress.com/3124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/robgarrett.wordpress.com/3124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/robgarrett.wordpress.com/3124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/robgarrett.wordpress.com/3124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/robgarrett.wordpress.com/3124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/robgarrett.wordpress.com/3124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/robgarrett.wordpress.com/3124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/robgarrett.wordpress.com/3124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/robgarrett.wordpress.com/3124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/robgarrett.wordpress.com/3124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/robgarrett.wordpress.com/3124/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.robgarrett.com&amp;blog=7688126&amp;post=3124&amp;subd=robgarrett&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.robgarrett.com/2008/11/07/recycle-iis-app-pool-from-script/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Rob Garrett</media:title>
		</media:content>
	</item>
		<item>
		<title>Debugging SharePoint, which Process?</title>
		<link>http://blog.robgarrett.com/2008/10/28/debugging-sharepoint-which-process/</link>
		<comments>http://blog.robgarrett.com/2008/10/28/debugging-sharepoint-which-process/#comments</comments>
		<pubDate>Tue, 28 Oct 2008 19:41:20 +0000</pubDate>
		<dc:creator>Rob Garrett</dc:creator>
				<category><![CDATA[Everything]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Microsoft SharePoint]]></category>

		<guid isPermaLink="false">/cs/blogs/software/archive/2008/10/28/debugging-sharepoint-which-process.aspx</guid>
		<description><![CDATA[When developing 3rd party components for SharePoint you cannot avoid debugging.&#160; Debugging usually involves attaching to a W3WP.EXE process &#8211; IIS host for a SharePoint application, from within Visual Studio.&#160; When presented with the attach to process dialog box, you should typically see two to three instances of W3WP.EXE, one for central administration site, maybe [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.robgarrett.com&amp;blog=7688126&amp;post=3121&amp;subd=robgarrett&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>When developing 3rd party components for SharePoint you cannot avoid debugging.&#160; Debugging usually involves attaching to a W3WP.EXE process &#8211; IIS host for a SharePoint application, from within Visual Studio.&#160; </p>
<p>When presented with the <em>attach to process</em> dialog box, you should typically see two to three instances of W3WP.EXE, one for central administration site, maybe another for the SSP administration site, and one for your web application:</p>
<p><a href="http://robgarrett.files.wordpress.com/2009/05/0001.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" alt="image" src="http://robgarrett.files.wordpress.com/2009/05/0001.png?w=512" width="512" border="0" /></a> </p>
<p>So.. which process should you attach?&#160; Most developers (myself included) attach to all &#8211; just to be sure.&#160; But what if you want to know exactly which process to attach?&#160; </p>
<p>My colleague &#8211; Kevin Vieira gave made me aware of IISAPP.EXE &#8211; a nice built in tool to list all of IIS hosted web applications with associated PID:</p>
<p>W3WP.exe PID: 236&#160;&#160; AppPoolId: SharePoint &#8211; 80   <br />W3WP.exe PID: 244&#160;&#160; AppPoolId: SharePoint &#8211; 5000    <br />W3WP.exe PID: 3616&#160;&#160; AppPoolId: SharePoint Central Administration v3</p>
<br /> Tagged: Microsoft SharePoint <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/robgarrett.wordpress.com/3121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/robgarrett.wordpress.com/3121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/robgarrett.wordpress.com/3121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/robgarrett.wordpress.com/3121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/robgarrett.wordpress.com/3121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/robgarrett.wordpress.com/3121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/robgarrett.wordpress.com/3121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/robgarrett.wordpress.com/3121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/robgarrett.wordpress.com/3121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/robgarrett.wordpress.com/3121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/robgarrett.wordpress.com/3121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/robgarrett.wordpress.com/3121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/robgarrett.wordpress.com/3121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/robgarrett.wordpress.com/3121/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.robgarrett.com&amp;blog=7688126&amp;post=3121&amp;subd=robgarrett&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.robgarrett.com/2008/10/28/debugging-sharepoint-which-process/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Rob Garrett</media:title>
		</media:content>

		<media:content url="http://robgarrett.files.wordpress.com/2009/05/0001.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>SharePoint Content Structure and Reports Limit</title>
		<link>http://blog.robgarrett.com/2008/10/10/sharepoint-content-structure-and-reports-limit/</link>
		<comments>http://blog.robgarrett.com/2008/10/10/sharepoint-content-structure-and-reports-limit/#comments</comments>
		<pubDate>Fri, 10 Oct 2008 20:56:37 +0000</pubDate>
		<dc:creator>Rob Garrett</dc:creator>
				<category><![CDATA[Everything]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Microsoft SharePoint]]></category>

		<guid isPermaLink="false">/cs/blogs/software/archive/2008/10/10/sharepoint-content-structure-and-reports-limit.aspx</guid>
		<description><![CDATA[We ran into an interesting issue this week where all reports at the site collection level within &#34;Content Structure and Reports&#34; stopped working.&#160; The log included the following error: Query Execution threw SPException: The query cannot be completed because the number of lists in the query exceeded the allowable limit &#160; 10/10/2008 11:38:19.16&#160;&#160;&#160;&#160; w3wp.exe (0x09F8)&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.robgarrett.com&amp;blog=7688126&amp;post=3113&amp;subd=robgarrett&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>We ran into an interesting issue this week where all reports at the site collection level within &quot;Content Structure and Reports&quot; stopped working.&#160; The log included the following error:</p>
<p><em>Query Execution threw SPException: The query cannot be completed because the number of lists in the query exceeded the allowable limit      <br />&#160; 10/10/2008 11:38:19.16&#160;&#160;&#160;&#160; w3wp.exe (0x09F8)&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 0x07F8&#160;&#160;&#160; CMS&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Site Management&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 622h&#160;&#160;&#160; <br />Unexpected&#160;&#160;&#160; SMReportsData GetQueryResults &#8211; Query Execution threw SPException: The query cannot be completed because the number of lists in the query       <br />exceeded the allowable limit. For better results, limit the scope of the query to the current site or list or use a custom column index to help reduce the number of lists.&#160;&#160;&#160;&#160; </em></p>
<p>My esteemed colleague Carlos Fernandez uncovered the following fix&#8230;</p>
<p><a href="http://robgarrett.files.wordpress.com/2009/05/0002.png"><img style="border-width:0;" alt="image" src="http://robgarrett.files.wordpress.com/2009/05/0002.png?w=512" width="512" border="0" /></a> </p>
<p>The default lists limit for the query generated by these reports is a 1000, so running the reports at the site collection level caused SharePoint to exceed this amount when the site contained more than 1000 page libraries.&#160; Populating the CAML List Type with: </p>
<p>&lt;Lists BaseType=&quot;1&quot; MaxListsLimit=&quot;0&quot;/&gt;</p>
<br /> Tagged: Microsoft SharePoint <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/robgarrett.wordpress.com/3113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/robgarrett.wordpress.com/3113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/robgarrett.wordpress.com/3113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/robgarrett.wordpress.com/3113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/robgarrett.wordpress.com/3113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/robgarrett.wordpress.com/3113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/robgarrett.wordpress.com/3113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/robgarrett.wordpress.com/3113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/robgarrett.wordpress.com/3113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/robgarrett.wordpress.com/3113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/robgarrett.wordpress.com/3113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/robgarrett.wordpress.com/3113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/robgarrett.wordpress.com/3113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/robgarrett.wordpress.com/3113/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.robgarrett.com&amp;blog=7688126&amp;post=3113&amp;subd=robgarrett&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.robgarrett.com/2008/10/10/sharepoint-content-structure-and-reports-limit/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Rob Garrett</media:title>
		</media:content>

		<media:content url="http://robgarrett.files.wordpress.com/2009/05/0002.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
	</channel>
</rss>
