<?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>SharePoint Sharpener &#187; Development</title>
	<atom:link href="http://sharepointsharpener.wordpress.com/category/development/feed/" rel="self" type="application/rss+xml" />
	<link>http://sharepointsharpener.wordpress.com</link>
	<description>Obsessively Sharpening SharePoint</description>
	<lastBuildDate>Mon, 19 Oct 2009 21:48:56 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='sharepointsharpener.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/a13c576c6a4d38c391bc0a6d1d7261ba?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>SharePoint Sharpener &#187; Development</title>
		<link>http://sharepointsharpener.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://sharepointsharpener.wordpress.com/osd.xml" title="SharePoint Sharpener" />
		<item>
		<title>SPC09: Overview of New Developer Features in SharePoint 2010</title>
		<link>http://sharepointsharpener.wordpress.com/2009/10/19/spc09-overview-of-new-developer-features-in-sharepoint-2010/</link>
		<comments>http://sharepointsharpener.wordpress.com/2009/10/19/spc09-overview-of-new-developer-features-in-sharepoint-2010/#comments</comments>
		<pubDate>Mon, 19 Oct 2009 21:48:56 +0000</pubDate>
		<dc:creator>Thomas Sondergaard</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[developer dashboard]]></category>
		<category><![CDATA[development environment]]></category>
		<category><![CDATA[dialog]]></category>
		<category><![CDATA[linq]]></category>
		<category><![CDATA[ribbon]]></category>
		<category><![CDATA[sharepoint 2010]]></category>
		<category><![CDATA[silverlight]]></category>
		<category><![CDATA[visual studio]]></category>
		<category><![CDATA[visual studio 2010]]></category>
		<category><![CDATA[wsp]]></category>
		<category><![CDATA[wss 4.0]]></category>

		<guid isPermaLink="false">http://sharepointsharpener.wordpress.com/2009/10/19/spc09-overview-of-new-developer-features-in-sharepoint-2010/</guid>
		<description><![CDATA[&#160;
At the SharePoint Conference in Las Vegas, Paul Andrew gave a thorough overview of the new features for developers in SharePoint 2010.
This is my modest attempt to convey Paul’s presentation in a simple blog post. Please note that the session contained a huge amount of information and I probably (definitely!) didn’t manage to take it [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sharepointsharpener.wordpress.com&blog=4068218&post=113&subd=sharepointsharpener&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>&#160;</p>
<p>At the <a href="http://www.mssharepointconference.com/" target="_blank">SharePoint Conference</a> in Las Vegas, <a href="http://blogs.msdn.com/pandrew/" target="_blank">Paul Andrew</a> gave a thorough overview of the new features for developers in SharePoint 2010.</p>
<p>This is my modest attempt to convey Paul’s presentation in a simple blog post. Please note that the session contained a huge amount of information and I probably (definitely!) didn’t manage to take it all in. Read on at your own risk…</p>
<p>&#160;</p>
<p><strong>Development environment and tools</strong></p>
<p>Traditionally, the path to your first SharePoint hello world-web part is littered with technical obstacles in the shape of tedious installation problems, Windows Server 2003 blues, virtual server nightmares etc. No more. Now you just need your laptop to develop SharePoint applications.</p>
<p><u>The box</u></p>
<p>SharePoint developers no longer need to run a Windows 2003 Server. In fact, SharePoint and the development tools can now be installed directly on Windows 7 or Vista (service pack 1). Either versions of SharePoint can be used, i.e. SharePoint Foundation (formerly WSS) or SharePoint Server.</p>
<p>The operating system must be 64 bit since SharePoint 2010 only runs in a 64 bit environment.</p>
<p>SharePoint on a desktop operating system is just for developers and not for running a production environment.</p>
<p>&#160;</p>
<p><u>Visual Studio 2010</u></p>
<p>Many of SharePoint 2010’s new features can be accessed from inside Visual Studio 2010. Also, quite a few third-party add-ons may not be needed anymore as the functionality is now covered by Visual Studio.</p>
<p>Highlights:</p>
<ul>
<li>Built-in designers for:</li>
<ul>
<li>Web parts</li>
<li>BCS (formerly BDC)</li>
<li>Workflows</li>
</ul>
<li>Package and deploy SharePoint projects</li>
<li>Generate WSPs</li>
<li>View SharePoint sites in server explorer</li>
<li>Integration to Team Foundation Server</li>
<li>Support for SharePoint sandboxed solutions</li>
<li>WSPs from SharePoint Designer can be imported (including workflows)</li>
<li>Build workflow steps for SharePoint Designer</li>
<li>SharePoint Business Connectivity Services support</li>
<li>New events projects templates</li>
</ul>
<p>&#160;</p>
<p><strong>General improvents</strong></p>
<p><u>Developer dashboard</u></p>
<p>A developer dashboard can be displayed automatically at the bottom of every page. The DD displays valuable information about how the page is generated, for instance:</p>
<ul>
<li>Timing and duration of events</li>
<li>Database queries (even the ones SharePoint does in the background)</li>
</ul>
<p>The DD is activated with the follow stsadm command:</p>
<p>stsadm –o setproperty –pn developer-dashboard –pv ondemand</p>
<p>&#160;</p>
<p><u>Coding</u></p>
<p>Coding for SharePoint just got slightly easier due to the many improvements in .NET framework 4.0 and SharePoint 2010.</p>
<p>Below is a rundown of some of the new features:</p>
<ul>
<li>LINQ for SharePoint</li>
<li>After-synchronous events</li>
<li>New event types:</li>
<ul>
<li>Site-scoped events</li>
<li>Web creation events</li>
</ul>
<li>Workflow improvements:</li>
<ul>
<li>Initiation and association forms in Visual Studio</li>
<li>New design user interface for workflows in SharePoint Designer</li>
<li>Use Visio 2010 to design workflows</li>
</ul>
<li>SharePoint UI can now be saved as a template</li>
<li>WSP is now the unified developer format – works in site collections and machine</li>
</ul>
<p>&#160;</p>
<p><u>Improvements to lists</u></p>
<p>In SharePoint 2007, lists can cause any developer headaches. Hopefully, the new list architecture in SharePoint 2010 will solve this. Below is an overview of some of the improvements:</p>
<ul>
<li>Validation with Excel-like Formula &#8211; forms can be validated using simple syntax</li>
<li>Lookup to multiple columns</li>
<li>Lookup fields have true relations which ensure proper deletion (transaction-style)</li>
<li>List index auto-creation</li>
<li>Scalability and performance vastly improved:</li>
<ul>
<li>Lists and folders can now contain a million elements</li>
<li>Document libraries can contain 10 million documents</li>
</ul>
<li>List query throttling</li>
<li>Lists views no longer based on CAML but XSL-T. Queries still use CAML</li>
</ul>
<p>&#160;</p>
<p><u>Ribbon and Dialog framework</u></p>
<p>The ribbon we know (and some love) from Microsoft Office is now used in SharePoint 2010.</p>
<p>Some of the highlights:</p>
<ul>
<li>Custom actions can be embedded in the ribbon</li>
<li>The ribbon is context sensitive</li>
<li>The SharePoint out-of-the-box forms are replaceable</li>
<li>New web dialog functionality:</li>
<ul>
<li>A dialog floats on top of the SharePoint page and is used to get input from the user</li>
<li>Fully programmable</li>
</ul>
</ul>
<p>&#160;</p>
<p><u>Silverlight 3</u></p>
<p>Silverlight plays an important part in SharePoint 2010 and is used in many of the improved UI elements. From a developer’s point of view, these are the highlights:</p>
<ul>
<li>Built-it and customisable media player web part</li>
<li>List and site creation from within Silverlight</li>
<li>Office web applications run in Silverlight</li>
<li>Client object model &#8211; call SharePoint APIs from within Silverlight</li>
</ul>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sharepointsharpener.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sharepointsharpener.wordpress.com/113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sharepointsharpener.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sharepointsharpener.wordpress.com/113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sharepointsharpener.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sharepointsharpener.wordpress.com/113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sharepointsharpener.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sharepointsharpener.wordpress.com/113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sharepointsharpener.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sharepointsharpener.wordpress.com/113/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sharepointsharpener.wordpress.com&blog=4068218&post=113&subd=sharepointsharpener&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sharepointsharpener.wordpress.com/2009/10/19/spc09-overview-of-new-developer-features-in-sharepoint-2010/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0dfb315d39c37443371df076767fa665?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">thomassondergaard</media:title>
		</media:content>
	</item>
		<item>
		<title>Crawl Problem with Multiple Value Lookup Fields Acknowledged by Microsoft</title>
		<link>http://sharepointsharpener.wordpress.com/2009/08/13/crawl-problem-with-multiple-value-lookup-fields-acknowledged-by-microsoft/</link>
		<comments>http://sharepointsharpener.wordpress.com/2009/08/13/crawl-problem-with-multiple-value-lookup-fields-acknowledged-by-microsoft/#comments</comments>
		<pubDate>Thu, 13 Aug 2009 07:39:27 +0000</pubDate>
		<dc:creator>Thomas Sondergaard</dc:creator>
				<category><![CDATA[Configuration]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Optimisation]]></category>
		<category><![CDATA[Trouble-shooting]]></category>
		<category><![CDATA[crawl]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[fail]]></category>
		<category><![CDATA[index]]></category>
		<category><![CDATA[kb]]></category>
		<category><![CDATA[log]]></category>

		<guid isPermaLink="false">http://sharepointsharpener.wordpress.com/2009/08/13/crawl-problem-with-multiple-value-lookup-fields-acknowledged-by-microsoft/</guid>
		<description><![CDATA[Last year we at PeopleNet ran into a problem when using lists with many columns, i.e. around 1600!
Indexing such a list would almost always fail with a timeout or out of memory error in the log, even though SharePoint is supposed to be able to handle at least 2000 columns without performance issues.
We corresponded back [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sharepointsharpener.wordpress.com&blog=4068218&post=109&subd=sharepointsharpener&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Last year we at PeopleNet ran into a problem when using lists with many columns, i.e. around 1600!</p>
<p>Indexing such a list would almost always fail with a timeout or out of memory error in the log, even though SharePoint is supposed to be able to handle at least 2000 columns without performance issues.</p>
<p>We corresponded back and forth with a Microsoft support engineer about the problem and it turned out that lists with many multiple value lookup fields will bring the SQL Server to its knees fairly quickly.</p>
<p>Microsoft has recently released a <a href="http://support.microsoft.com/kb/970196" target="_blank">KB article</a> in relation to this, however, it doesn’t specifically single out multiple value lookup fields as the culprit, although they almost always are.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sharepointsharpener.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sharepointsharpener.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sharepointsharpener.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sharepointsharpener.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sharepointsharpener.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sharepointsharpener.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sharepointsharpener.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sharepointsharpener.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sharepointsharpener.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sharepointsharpener.wordpress.com/109/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sharepointsharpener.wordpress.com&blog=4068218&post=109&subd=sharepointsharpener&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sharepointsharpener.wordpress.com/2009/08/13/crawl-problem-with-multiple-value-lookup-fields-acknowledged-by-microsoft/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0dfb315d39c37443371df076767fa665?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">thomassondergaard</media:title>
		</media:content>
	</item>
		<item>
		<title>How To Always Link to the Right Application Pages</title>
		<link>http://sharepointsharpener.wordpress.com/2009/05/16/how-to-always-link-to-the-right-application-pages/</link>
		<comments>http://sharepointsharpener.wordpress.com/2009/05/16/how-to-always-link-to-the-right-application-pages/#comments</comments>
		<pubDate>Sat, 16 May 2009 15:01:36 +0000</pubDate>
		<dc:creator>Thomas Sondergaard</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[allitems]]></category>
		<category><![CDATA[application pages]]></category>
		<category><![CDATA[broken links]]></category>
		<category><![CDATA[dispform]]></category>
		<category><![CDATA[editform]]></category>
		<category><![CDATA[links]]></category>
		<category><![CDATA[newform]]></category>
		<category><![CDATA[pagetype]]></category>

		<guid isPermaLink="false">http://sharepointsharpener.wordpress.com/2009/05/16/how-to-always-link-to-the-right-application-pages/</guid>
		<description><![CDATA[As a SharePoint developer you&#8217;ve probably run into this problem several times: How to make sure that links to application pages stay valid irrespective of where within a site collection your web part is placed.
If you hand-code links you&#8217;re likely to get the path relative to the root site wrong. Even worse, if the the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sharepointsharpener.wordpress.com&blog=4068218&post=108&subd=sharepointsharpener&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>As a SharePoint developer you&#8217;ve probably run into this problem several times: How to make sure that links to application pages stay valid irrespective of where within a site collection your web part is placed.</p>
<p>If you hand-code links you&#8217;re likely to get the path relative to the root site wrong. Even worse, if the the filename of an application page is changed, e.g. from DispForm.aspx to DispFormNew.aspx, your links will surely break.</p>
<p>&nbsp;</p>
<p><strong>The application pages</strong></p>
<p>Generally, a SharePoint list contains the following application pages:</p>
<ul>
<li>AllItems.aspx<br /><em>Shows all items in the list</em></li>
<li>DispForm.aspx<br /><em>Displays a read-only version of a list item</em></li>
<li>NewForm.aspx<br /><em>Form for creating a new list item</em></li>
<li>EditForm.aspx<br /><em>Form for editing an existing list item</em></li>
</ul>
<p>More applications pages exist but these are the ones most commonly used.</p>
<p><strong></strong>&nbsp;</p>
<p><strong>Ensuring unbroken links programmatically</strong></p>
<p>The <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.pagetype.aspx" target="_blank">PAGETYPE Enumeration</a> gives you access to the application pages and enables you to build links that always work.</p>
<p>Assuming you have already created your <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splist.aspx" target="_blank">SPList</a> and <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splistitem.aspx" target="_blank">SPListItem</a> objects the below snippet builds a link to the correct DispForm:</p>
<p><img style="border-bottom:0;border-left:0;border-top:0;border-right:0;" border="0" alt="list.Forms[PAGETYPE.PAGE_DISPLAYFORM].ServerRelativeUrl.ToString();" src="http://sharepointsharpener.files.wordpress.com/2009/05/image.png?w=614&#038;h=45" width="614" height="45"></p>
<p>Of course, the same applies to NewForm and EditForm.</p>
<p>&nbsp;</p>
<p><strong>Linking to the default view of a list</strong></p>
<p>Below a list of elements you may wish to link to the underlying list&#8217;s default view. In many cases this will be the AllItems.aspx page but what happens if a user changes the default view in the settings of the list? If you&#8217;ve hardcoded a link to AllItems.aspx you may be lucky that the link still works but if AllItems.aspx has been renamed or removed, you&#8217;re out of luck.</p>
<p>Instead of hardcoding the link you should use PAGE_DEFAULTVIEW, like this:</p>
<p><img style="border-bottom:0;border-left:0;border-top:0;border-right:0;" border="0" alt="list.Forms[PAGETYPE.PAGE_DEFAULTVIEW].ServerRelativeUrl.ToString();" src="http://sharepointsharpener.files.wordpress.com/2009/05/image1.png?w=482&#038;h=33" width="482" height="33"> </p>
<p>Simple, isn&#8217;t it?</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sharepointsharpener.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sharepointsharpener.wordpress.com/108/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sharepointsharpener.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sharepointsharpener.wordpress.com/108/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sharepointsharpener.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sharepointsharpener.wordpress.com/108/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sharepointsharpener.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sharepointsharpener.wordpress.com/108/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sharepointsharpener.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sharepointsharpener.wordpress.com/108/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sharepointsharpener.wordpress.com&blog=4068218&post=108&subd=sharepointsharpener&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sharepointsharpener.wordpress.com/2009/05/16/how-to-always-link-to-the-right-application-pages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0dfb315d39c37443371df076767fa665?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">thomassondergaard</media:title>
		</media:content>

		<media:content url="http://sharepointsharpener.files.wordpress.com/2009/05/image.png" medium="image">
			<media:title type="html">list.Forms[PAGETYPE.PAGE_DISPLAYFORM].ServerRelativeUrl.ToString();</media:title>
		</media:content>

		<media:content url="http://sharepointsharpener.files.wordpress.com/2009/05/image1.png" medium="image">
			<media:title type="html">list.Forms[PAGETYPE.PAGE_DEFAULTVIEW].ServerRelativeUrl.ToString();</media:title>
		</media:content>
	</item>
		<item>
		<title>Programmatically Checking if a SharePoint Element is Published</title>
		<link>http://sharepointsharpener.wordpress.com/2009/03/26/programmatically-checking-if-a-sharepoint-element-is-published/</link>
		<comments>http://sharepointsharpener.wordpress.com/2009/03/26/programmatically-checking-if-a-sharepoint-element-is-published/#comments</comments>
		<pubDate>Thu, 26 Mar 2009 18:25:27 +0000</pubDate>
		<dc:creator>Thomas Sondergaard</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[spfilelevel]]></category>
		<category><![CDATA[splistitem]]></category>
		<category><![CDATA[version]]></category>
		<category><![CDATA[versioning]]></category>
		<category><![CDATA[versions]]></category>

		<guid isPermaLink="false">http://sharepointsharpener.wordpress.com/2009/03/26/programmatically-checking-if-a-sharepoint-element-is-published/</guid>
		<description><![CDATA[Here&#8217;s a quick tip for you: How to check if the latest version of an element in a SharePoint list is published.
Once you&#8217;ve got hold of an SPListItem, you can check the Versions property (an array containing all the versions of the element).
In this block of code IsPublished becomes True if the latest version is [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sharepointsharpener.wordpress.com&blog=4068218&post=103&subd=sharepointsharpener&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Here&#8217;s a quick tip for you: How to check if the latest version of an element in a SharePoint list is published.</p>
<p>Once you&#8217;ve got hold of an <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splistitem.aspx" target="_blank">SPListItem</a>, you can check the <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splistitem.versions.aspx" target="_blank">Versions</a> property (an array containing all the versions of the element).</p>
<p>In this block of code IsPublished becomes True if the latest version is published:</p>
<p><img style="border-bottom:0;border-left:0;border-top:0;border-right:0;" border="0" alt="bool IsPublished = TheItem.Versions[0].Level == SPFileLevel.Published ? true : false;" src="http://sharepointsharpener.files.wordpress.com/2009/03/image5.png?w=701&#038;h=51" width="701" height="51"></p>
<p>&nbsp;</p>
<p> That&#8217;s it.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sharepointsharpener.wordpress.com/103/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sharepointsharpener.wordpress.com/103/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sharepointsharpener.wordpress.com/103/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sharepointsharpener.wordpress.com/103/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sharepointsharpener.wordpress.com/103/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sharepointsharpener.wordpress.com/103/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sharepointsharpener.wordpress.com/103/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sharepointsharpener.wordpress.com/103/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sharepointsharpener.wordpress.com/103/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sharepointsharpener.wordpress.com/103/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sharepointsharpener.wordpress.com&blog=4068218&post=103&subd=sharepointsharpener&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sharepointsharpener.wordpress.com/2009/03/26/programmatically-checking-if-a-sharepoint-element-is-published/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0dfb315d39c37443371df076767fa665?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">thomassondergaard</media:title>
		</media:content>

		<media:content url="http://sharepointsharpener.files.wordpress.com/2009/03/image5.png" medium="image">
			<media:title type="html">bool IsPublished = TheItem.Versions[0].Level == SPFileLevel.Published ? true : false;</media:title>
		</media:content>
	</item>
		<item>
		<title>JavaScript Tips for SharePoint</title>
		<link>http://sharepointsharpener.wordpress.com/2009/03/23/javascript-tips-for-sharepoint/</link>
		<comments>http://sharepointsharpener.wordpress.com/2009/03/23/javascript-tips-for-sharepoint/#comments</comments>
		<pubDate>Mon, 23 Mar 2009 23:31:37 +0000</pubDate>
		<dc:creator>Thomas Sondergaard</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[clientside]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[sharepoint]]></category>

		<guid isPermaLink="false">http://sharepointsharpener.wordpress.com/2009/03/23/javascript-tips-for-sharepoint/</guid>
		<description><![CDATA[I&#8217;ve gatherered a few productive tips for using JavaScript within SharePoint. The below commands can be used within webparts etc. or directly in the browser&#8217;s address field while you&#8217;re on a SharePoint page, like this:
 
Putting javascript: in front of your script snippet will fire it right there and then.
These commands are neither terribly advanced [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sharepointsharpener.wordpress.com&blog=4068218&post=99&subd=sharepointsharpener&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I&#8217;ve gatherered a few productive tips for using JavaScript within SharePoint. The below commands can be used within webparts etc. or directly in the browser&#8217;s address field while you&#8217;re on a SharePoint page, like this:</p>
<p><img style="border-width:0;" height="229" alt="" src="http://sharepointsharpener.files.wordpress.com/2009/03/image.png?w=434&#038;h=229" width="434" border="0"> </p>
<p>Putting <em>javascript:</em> in front of your script snippet will fire it right there and then.</p>
<p>These commands are neither terribly advanced nor applicable on all pages, but they make for a useful reference all the same. I aim to continually update this page with new content so if you have any JavaScript tips, feel free to drop them in the comments.</p>
<p>&nbsp;</p>
<p><strong>Edit an application page: MSOLayout_ToggleLayoutMode()</strong></p>
<p>This enables edit mode on SharePoint&#8217;s application pages, like EditForm.aspx, DispForm.aspx etc. so you can insert web parts above or below the normal content:</p>
<p><img style="border-width:0;" height="325" alt="" src="http://sharepointsharpener.files.wordpress.com/2009/03/image1.png?w=676&#038;h=325" width="676" border="0"> </p>
<p>&nbsp;</p>
<p><strong>Pop-up an alert with the User ID og the logged-in user: alert(_spUserId)</strong></p>
<p><img style="border-width:0;" height="244" alt="" src="http://sharepointsharpener.files.wordpress.com/2009/03/image2.png?w=465&#038;h=244" width="465" border="0"> </p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><strong>Enable the Edit toolbar: javascript:__doPostBack(&#8216;ctl00$PlaceHolderTopNavBar$SiteActionsMenuMain$ctl00$wsaShowMenu_CmsActionControl&#8217;,'reviewPage&#8217;)</strong></p>
<p>Simply enables the toolbar where you can access the page edit functions:</p>
<p><img style="border-width:0;" height="247" alt="" src="http://sharepointsharpener.files.wordpress.com/2009/03/image3.png?w=536&#038;h=247" width="536" border="0"> </p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><strong>Hide the Edit toolbar: __doPostBack(&#8216;ctl00$PlaceHolderTopNavBar$SiteActionsMenuMain$ctl00$wsaHideMenu_CmsActionControl&#8217;,'exitMenu&#8217;)</strong></p>
<p>No prizes for guessing this one.</p>
<p>&nbsp;</p>
<p><strong>Show help: TopHelpButtonClick(&#8216;NavBarHelpHome&#8217;)</strong></p>
<p>Pops up the built-in help page. Interestingly, you can try this on Microsoft&#8217;s SharePoint Conference <a href="http://www.mssharepointconference.com/" target="_blank">web site</a>:</p>
<p><img style="border-width:0;" height="432" alt="" src="http://sharepointsharpener.files.wordpress.com/2009/03/image4.png?w=695&#038;h=432" width="695" border="0"></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sharepointsharpener.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sharepointsharpener.wordpress.com/99/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sharepointsharpener.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sharepointsharpener.wordpress.com/99/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sharepointsharpener.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sharepointsharpener.wordpress.com/99/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sharepointsharpener.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sharepointsharpener.wordpress.com/99/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sharepointsharpener.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sharepointsharpener.wordpress.com/99/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sharepointsharpener.wordpress.com&blog=4068218&post=99&subd=sharepointsharpener&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sharepointsharpener.wordpress.com/2009/03/23/javascript-tips-for-sharepoint/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0dfb315d39c37443371df076767fa665?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">thomassondergaard</media:title>
		</media:content>

		<media:content url="http://sharepointsharpener.files.wordpress.com/2009/03/image.png" medium="image" />

		<media:content url="http://sharepointsharpener.files.wordpress.com/2009/03/image1.png" medium="image" />

		<media:content url="http://sharepointsharpener.files.wordpress.com/2009/03/image2.png" medium="image" />

		<media:content url="http://sharepointsharpener.files.wordpress.com/2009/03/image3.png" medium="image" />

		<media:content url="http://sharepointsharpener.files.wordpress.com/2009/03/image4.png" medium="image" />
	</item>
		<item>
		<title>Developing Workflows Not Possible on 64-Bit SharePoint</title>
		<link>http://sharepointsharpener.wordpress.com/2009/01/12/developing-workflows-not-possible-on-64-bit-sharepoint/</link>
		<comments>http://sharepointsharpener.wordpress.com/2009/01/12/developing-workflows-not-possible-on-64-bit-sharepoint/#comments</comments>
		<pubDate>Mon, 12 Jan 2009 22:17:50 +0000</pubDate>
		<dc:creator>Thomas Sondergaard</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Trouble-shooting]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[visual studio]]></category>
		<category><![CDATA[workflow]]></category>

		<guid isPermaLink="false">http://sharepointsharpener.wordpress.com/2009/01/12/developing-workflows-not-possible-on-64-bit-sharepoint/</guid>
		<description><![CDATA[As most companies are moving to the 64-bit platform of Windows Server and MOSS, more SharePoint developers are adopting this as their main dev environment.
However, if you plan to develop SharePoint workflows in Visual Studio 2008 on your new 64-bit box, you&#8217;re going to be disappointed.
Upon creating a new workflow in VS, an &#8220;Object reference [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sharepointsharpener.wordpress.com&blog=4068218&post=78&subd=sharepointsharpener&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>As most companies are moving to the 64-bit platform of Windows Server and MOSS, more SharePoint developers are adopting this as their main dev environment.</p>
<p>However, if you plan to develop SharePoint workflows in Visual Studio 2008 on your new 64-bit box, you&#8217;re going to be disappointed.</p>
<p>Upon creating a new workflow in VS, an &#8220;Object reference not set to an instance of an object&#8221;-error pops up:</p>
<p>&nbsp;</p>
<p><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="119" alt="Object reference not set to an instance of an object" src="http://sharepointsharpener.files.wordpress.com/2009/01/image1.png?w=332&#038;h=119" width="332" border="0"> </p>
<p>&nbsp;</p>
<p>You can still get to the next step in the process where you have to chose the site which will be used to debug the workflow. Here too, you will be faced with an error:</p>
<p>&nbsp;</p>
<p><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="152" alt="SharePoint site location entered is not valid. The SharePoint site at --- could not be found. Verify that you have typed the URL correctly. If the URL should be serving content, the system administrator may need to add a new request URL mapping to the intended location" src="http://sharepointsharpener.files.wordpress.com/2009/01/image2.png?w=631&#038;h=152" width="631" border="0"></p>
<p>&nbsp;</p>
<p><strong>The solution</strong></p>
<p>Well, there isn&#8217;t any. Not right now anyway.</p>
<p>The only thing you can do is to continue developing in your old 32-bit environment and then move your WSP to the 64-bit box for installation.</p>
<p>All this is not a bug per se, rather, it&#8217;s down to Microsoft&#8217;s lack of resources in their dev team:</p>
<p><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="61" alt="" src="http://sharepointsharpener.files.wordpress.com/2009/01/image3.png?w=532&#038;h=61" width="532" border="0">&nbsp;<br />(<a href="http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=325668" target="_blank">source</a>)</p>
<p>Hmm&#8230;</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sharepointsharpener.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sharepointsharpener.wordpress.com/78/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sharepointsharpener.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sharepointsharpener.wordpress.com/78/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sharepointsharpener.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sharepointsharpener.wordpress.com/78/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sharepointsharpener.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sharepointsharpener.wordpress.com/78/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sharepointsharpener.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sharepointsharpener.wordpress.com/78/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sharepointsharpener.wordpress.com&blog=4068218&post=78&subd=sharepointsharpener&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sharepointsharpener.wordpress.com/2009/01/12/developing-workflows-not-possible-on-64-bit-sharepoint/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0dfb315d39c37443371df076767fa665?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">thomassondergaard</media:title>
		</media:content>

		<media:content url="http://sharepointsharpener.files.wordpress.com/2009/01/image1.png" medium="image">
			<media:title type="html">Object reference not set to an instance of an object</media:title>
		</media:content>

		<media:content url="http://sharepointsharpener.files.wordpress.com/2009/01/image2.png" medium="image">
			<media:title type="html">SharePoint site location entered is not valid. The SharePoint site at --- could not be found. Verify that you have typed the URL correctly. If the URL should be serving content, the system administrator may need to add a new request URL mapping to the intended location</media:title>
		</media:content>

		<media:content url="http://sharepointsharpener.files.wordpress.com/2009/01/image3.png" medium="image" />
	</item>
		<item>
		<title>Item.Update() vs. Item.SystemUpdate() &#8211; Post Service Pack 1</title>
		<link>http://sharepointsharpener.wordpress.com/2009/01/08/itemupdate-vs-itemsystemupdate-post-service-pack-1/</link>
		<comments>http://sharepointsharpener.wordpress.com/2009/01/08/itemupdate-vs-itemsystemupdate-post-service-pack-1/#comments</comments>
		<pubDate>Thu, 08 Jan 2009 08:53:22 +0000</pubDate>
		<dc:creator>Thomas Sondergaard</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Optimisation]]></category>
		<category><![CDATA[Trouble-shooting]]></category>
		<category><![CDATA[event]]></category>
		<category><![CDATA[event handler]]></category>
		<category><![CDATA[eventhandler]]></category>
		<category><![CDATA[service pack 1]]></category>
		<category><![CDATA[sp1]]></category>
		<category><![CDATA[systemupdate]]></category>
		<category><![CDATA[update]]></category>
		<category><![CDATA[workflow]]></category>

		<guid isPermaLink="false">http://sharepointsharpener.wordpress.com/2009/01/08/itemupdate-vs-itemsystemupdate-post-service-pack-1/</guid>
		<description><![CDATA[Many of you have probably encountered the problem where a workflow triggers itself several times because the code carries out one or more Item.Update() commands. This can be extremely annoying because running extra workflows can be taxing on the server &#8211; even if you make sure that the extra workflows don&#8217;t make any changes to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sharepointsharpener.wordpress.com&blog=4068218&post=73&subd=sharepointsharpener&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Many of you have probably encountered the problem where a workflow triggers itself several times because the code carries out one or more Item.Update() commands. This can be extremely annoying because running extra workflows can be taxing on the server &#8211; even if you make sure that the extra workflows don&#8217;t make any changes to the element.</p>
<p>Then, you may have discovered Item.SystemUpdate() which in theory should rid the list of the all the extra instances of workflows because it doesn&#8217;t trigger an update event and thus flies under the radar of the workflow engine.</p>
<p>This seemed to work just fine for a while. Lately, however, it seems that SystemUpdate() has startet triggering events just like a normal Update().</p>
<p>&nbsp;</p>
<p><strong>Post Service Pack 1?</strong></p>
<p>I found that many of my workflows now started behaving differently, i.e. they began triggering multiple instances of workflows.</p>
<p>It took me a while to realise that it probably was a &#8220;bug fix&#8221; in SharePoint SP1 that was causing the problem.</p>
<p>A glance at the <a href="http://msdn.microsoft.com/en-us/library/ms461526.aspx" target="_blank">documentation for SystemUpdate()</a> reveals that events are indeed triggered:</p>
<p><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="64" alt="image" src="http://sharepointsharpener.files.wordpress.com/2009/01/image.png?w=689&#038;h=64" width="689" border="0"> </p>
<p>There is no mention of SP1 but I assume that this was when the changes were made.</p>
<p>&nbsp;</p>
<p><strong>Solution</strong></p>
<p>This is bad news for many developers but obviously a design decision at Microsoft so things probably won&#8217;t be changed back to the way they were.</p>
<p>From now on you have to make sure that your workflows only make changes to elements when needed. I.e. you need to only use Update() and SystemUpdate() when they are really needed and thereby minimise the number of redundant workflow cycles.</p>
<p>Alternatively, you could look into programming your own event handlers to obtain more granular control of when events are triggered. I may explore this subject in a future post.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sharepointsharpener.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sharepointsharpener.wordpress.com/73/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sharepointsharpener.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sharepointsharpener.wordpress.com/73/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sharepointsharpener.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sharepointsharpener.wordpress.com/73/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sharepointsharpener.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sharepointsharpener.wordpress.com/73/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sharepointsharpener.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sharepointsharpener.wordpress.com/73/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sharepointsharpener.wordpress.com&blog=4068218&post=73&subd=sharepointsharpener&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sharepointsharpener.wordpress.com/2009/01/08/itemupdate-vs-itemsystemupdate-post-service-pack-1/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0dfb315d39c37443371df076767fa665?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">thomassondergaard</media:title>
		</media:content>

		<media:content url="http://sharepointsharpener.files.wordpress.com/2009/01/image.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>Elevation: Run Code as an Administrator</title>
		<link>http://sharepointsharpener.wordpress.com/2008/08/27/elevation-run-code-as-an-administrator/</link>
		<comments>http://sharepointsharpener.wordpress.com/2008/08/27/elevation-run-code-as-an-administrator/#comments</comments>
		<pubDate>Wed, 27 Aug 2008 06:56:51 +0000</pubDate>
		<dc:creator>Thomas Sondergaard</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[credentials]]></category>
		<category><![CDATA[delegate]]></category>
		<category><![CDATA[elevation]]></category>
		<category><![CDATA[privileges]]></category>
		<category><![CDATA[runwithelevatedprivileges]]></category>
		<category><![CDATA[spsecurity]]></category>
		<category><![CDATA[unauthorized]]></category>
		<category><![CDATA[web part]]></category>

		<guid isPermaLink="false">http://sharepointsharpener.wordpress.com/2008/08/27/elevation-run-code-as-an-administrator/</guid>
		<description><![CDATA[Sometimes you may need your web part to perform tasks for which the current user doesn&#8217;t have priviliges. For instance, we needed a sign up form for our WCM web site where the user could enter contact information that should be stored in a list.
Naturally, our web site runs with anonymous access and the the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sharepointsharpener.wordpress.com&blog=4068218&post=49&subd=sharepointsharpener&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Sometimes you may need your web part to perform tasks for which the current user doesn&#8217;t have priviliges. For instance, we needed a sign up form for our WCM web site where the user could enter contact information that should be stored in a list.</p>
<p>Naturally, our web site runs with anonymous access and the the anonymous users do not have access to the underlying lists, including the list where the contact information goes.</p>
<p>Thus, submitting to the list is not just a matter of doing an <em>Items.Add()</em> because this causes a login dialogue to pop up and ultimately a <em>401 Unauthorized</em> error.</p>
<p>Normally you&#8217;d create an element in the list with code similar to this:</p>
<p><img style="border-width:0;" height="169" alt="image" src="http://sharepointsharpener.files.wordpress.com/2008/08/image.png?w=501&#038;h=169" width="501" border="0"> </p>
<p>&nbsp;</p>
<p>However, if the logged-in user doesn&#8217;t have sufficient credentials to write to the list, a login dialogue will pop up.</p>
<p>&nbsp;</p>
<p><strong>Run with Elevation</strong></p>
<p>To get around this problem you can use <em>SPSecurity.RunWithElevatedPriviliges()</em> like this:</p>
<p><img style="border-width:0;" height="103" alt="image" src="http://sharepointsharpener.files.wordpress.com/2008/08/image1.png?w=406&#038;h=103" width="406" border="0"> </p>
<p>&nbsp;</p>
<p>For this to work, you need to instantiate the SPSite and SPWeb objects inside <em>delegate()</em>:</p>
<p><img style="border-width:0;" height="351" alt="image" src="http://sharepointsharpener.files.wordpress.com/2008/08/image2.png?w=621&#038;h=351" width="621" border="0"></p>
<p>&nbsp;</p>
<p>Now the list will be updated with a new element, created by the system account. </p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sharepointsharpener.wordpress.com/49/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sharepointsharpener.wordpress.com/49/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sharepointsharpener.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sharepointsharpener.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sharepointsharpener.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sharepointsharpener.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sharepointsharpener.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sharepointsharpener.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sharepointsharpener.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sharepointsharpener.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sharepointsharpener.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sharepointsharpener.wordpress.com/49/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sharepointsharpener.wordpress.com&blog=4068218&post=49&subd=sharepointsharpener&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sharepointsharpener.wordpress.com/2008/08/27/elevation-run-code-as-an-administrator/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0dfb315d39c37443371df076767fa665?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">thomassondergaard</media:title>
		</media:content>

		<media:content url="http://sharepointsharpener.files.wordpress.com/2008/08/image.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://sharepointsharpener.files.wordpress.com/2008/08/image1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://sharepointsharpener.files.wordpress.com/2008/08/image2.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>UserProfileService Web Service Returns Multiple Instances of User Profiles with Identical Names</title>
		<link>http://sharepointsharpener.wordpress.com/2008/08/08/userprofileservice-web-service-returns-multiple-instances-of-user-profiles-with-identical-names/</link>
		<comments>http://sharepointsharpener.wordpress.com/2008/08/08/userprofileservice-web-service-returns-multiple-instances-of-user-profiles-with-identical-names/#comments</comments>
		<pubDate>Fri, 08 Aug 2008 16:23:17 +0000</pubDate>
		<dc:creator>Thomas Sondergaard</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[user profile]]></category>
		<category><![CDATA[web part]]></category>
		<category><![CDATA[web service]]></category>

		<guid isPermaLink="false">http://sharepointsharpener.wordpress.com/2008/08/08/userprofileservice-web-service-returns-multiple-instances-of-user-profiles-with-identical-names/</guid>
		<description><![CDATA[The lack of a built-in overview of all users in SharePoint makes it difficult to create a simple phone book of your company&#8217;s employees. The object UserProfileManager would be the obvious starting point if you were to create your own phone book for SharePoint &#8211; and many have tried this. Google this object and you&#8217;ll [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sharepointsharpener.wordpress.com&blog=4068218&post=42&subd=sharepointsharpener&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>The lack of a built-in overview of all users in SharePoint makes it difficult to create a simple phone book of your company&#8217;s employees. The object <em><a href="http://msdn.microsoft.com/en-us/library/microsoft.office.server.userprofiles.userprofilemanager.aspx" target="_blank">UserProfileManager</a></em> would be the obvious starting point if you were to create your own phone book for SharePoint &#8211; and many have tried this. <a href="http://www.google.co.uk/search?hl=en&amp;q=UserProfileManager" target="_blank">Google this object</a> and you&#8217;ll find that the only real way to query all users effectively is using the built-in web services of MOSS.</p>
<p>Specifically, <em><a href="http://msdn.microsoft.com/en-us/library/aa980957.aspx" target="_blank">UserProfileService</a></em> (http://server/_vti_bin/userprofileservice.asmx) is ideal for querying user profiles from e.g. within a web part.</p>
<p>In Visual Studio, when you&#8217;ve set up the web service, you connect to the web services like so:</p>
<p><img style="border-width:0;" src="http://sharepointsharpener.files.wordpress.com/2008/08/image3.png?w=648&#038;h=78" border="0" alt="image" width="648" height="78" /></p>
<p>Then, you can query the number of profiles in the user profile database by calling the method <em><a href="http://msdn.microsoft.com/en-us/library/websvcuserprofileservice.userprofileservice.getuserprofilecount.aspx" target="_blank">GetUserProfileCount</a></em>:</p>
<p><img style="border-width:0;" src="http://sharepointsharpener.files.wordpress.com/2008/08/image4.png?w=433&#038;h=57" border="0" alt="image" width="433" height="57" /></p>
<p>Knowing the number of user profiles, you can iterate through them and pull the user data:</p>
<p><img style="border-width:0;" src="http://sharepointsharpener.files.wordpress.com/2008/08/image5.png?w=656&#038;h=174" border="0" alt="image" width="656" height="174" /></p>
<p><strong>Some names show up several times</strong></p>
<p>You will find, however, that <em><a href="http://msdn.microsoft.com/en-us/library/aa981288.aspx" target="_blank">GetUserProfileByIndex</a></em> only holds information about users whom have active MySites. Strangely enough, even if the total number of users exceed the number of users with MySites, you can still iterate through all the user profiles you found with <em>GetUserProfileCount</em>.</p>
<p>Say, you have the following people in your User Profile database:</p>
<p>1 &#8211; Ted Pattison<br />
2 &#8211; Liam Cleary<br />
3 &#8211; Amanda Murphy<br />
4 &#8211; Yvonne Harryman<br />
5 &#8211; Steve Pietrek</p>
<p>Let&#8217;s assume that Amanda and Yvonne don&#8217;t have MySites. Then the output of the above loop would look like this:</p>
<p>1 &#8211; Ted Pattison<br />
2 &#8211; Liam Cleary<br />
3 &#8211; Liam Cleary<br />
4 &#8211; Liam Cleary<br />
5 &#8211; Steve Pietrek</p>
<p><em>GetUserProfileByIndex</em> will not fail when you loop through 5 profiles because that is the number of profiles present in the database. On the other hand, querying a profile that doesn&#8217;t have a MySite, e.g. <em>GetUserProfileByIndex(3)</em> and <em>GetUserProfileByIndex(4)</em>, will return the latest user with a MySite, in this case Liam Cleary (index no. 2).</p>
<p><strong>Solution</strong></p>
<p>In order to avoid this situation the value stored in <em>NextValue</em> can be used. <em>NextValue</em> contains the index of the next user with a valid MySite user profile. Looking at the first table again, the <em>NextValue</em> values are shown in parentheses:</p>
<p>1 &#8211; Ted Pattison (2)<br />
2 &#8211; Liam Cleary (5)<br />
3 &#8211; Amanda Murphy (5)<br />
4 &#8211; Yvonne Harryman (5)<br />
5 &#8211; Steve Pietrek ()</p>
<p>The following line can then be added to the loop to ensure that the next profile to be shown contains usable information:</p>
<p><img style="border-width:0;" src="http://sharepointsharpener.files.wordpress.com/2008/08/image6.png?w=528&#038;h=52" border="0" alt="image" width="528" height="52" /></p>
<p>Now you just need to output all the information in an SPGridView and the phone book is ready to be implemented.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sharepointsharpener.wordpress.com/42/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sharepointsharpener.wordpress.com/42/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sharepointsharpener.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sharepointsharpener.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sharepointsharpener.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sharepointsharpener.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sharepointsharpener.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sharepointsharpener.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sharepointsharpener.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sharepointsharpener.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sharepointsharpener.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sharepointsharpener.wordpress.com/42/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sharepointsharpener.wordpress.com&blog=4068218&post=42&subd=sharepointsharpener&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sharepointsharpener.wordpress.com/2008/08/08/userprofileservice-web-service-returns-multiple-instances-of-user-profiles-with-identical-names/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0dfb315d39c37443371df076767fa665?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">thomassondergaard</media:title>
		</media:content>

		<media:content url="http://sharepointsharpener.files.wordpress.com/2008/08/image3.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://sharepointsharpener.files.wordpress.com/2008/08/image4.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://sharepointsharpener.files.wordpress.com/2008/08/image5.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://sharepointsharpener.files.wordpress.com/2008/08/image6.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>Custom Properties in a SharePoint web part</title>
		<link>http://sharepointsharpener.wordpress.com/2008/08/04/custom-properties-in-a-sharepoint-web-part/</link>
		<comments>http://sharepointsharpener.wordpress.com/2008/08/04/custom-properties-in-a-sharepoint-web-part/#comments</comments>
		<pubDate>Mon, 04 Aug 2008 13:21:22 +0000</pubDate>
		<dc:creator>Thomas Sondergaard</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[custom properties]]></category>
		<category><![CDATA[custom property]]></category>
		<category><![CDATA[properties]]></category>
		<category><![CDATA[property]]></category>
		<category><![CDATA[tool pane]]></category>

		<guid isPermaLink="false">http://sharepointsharpener.wordpress.com/2008/08/04/custom-properties-in-a-sharepoint-web-part/</guid>
		<description><![CDATA[It&#8217;s simple, really. Whenever you install a web part, it probably needs a few settings to work properly.
Maybe the web part needs to know the name of a specific list to be able to gather information and display it to the user. Or perhaps it requires the email address of the person who should receive [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sharepointsharpener.wordpress.com&blog=4068218&post=36&subd=sharepointsharpener&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>It&#8217;s simple, really. Whenever you install a web part, it probably needs a few settings to work properly.</p>
<p>Maybe the web part needs to know the name of a specific list to be able to gather information and display it to the user. Or perhaps it requires the email address of the person who should receive status updates from the web part.</p>
<p>In any case you want the web part to be able to store simple textual and persistant information to be used in your code. You may of course decide to store this information in, say, a SQL Server table but &#8211; unless you need to store vast amounts of information &#8211; this is overkill and makes installation of the web part unecessarily difficult.</p>
<p>&nbsp;</p>
<p><strong>Custom web part properties to the rescue</strong></p>
<p>You can add your own properties to the tool pane which appears when you access the settings of a web part in the browser. You can even make your properties appear in its own section, like this:</p>
<p>&nbsp;<img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="144" alt="image" src="http://sharepointsharpener.files.wordpress.com/2008/08/image10.png?w=231&#038;h=144" width="231" border="0"> </p>
<p>&nbsp;</p>
<p>To achieve this, first add the following namespaces to your web part code:</p>
<p>&nbsp;<img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="57" alt="image" src="http://sharepointsharpener.files.wordpress.com/2008/08/image11.png?w=360&#038;h=57" width="360" border="0"> </p>
<p>&nbsp;</p>
<p>Then, for each property you need, insert a code block similar to this: </p>
<p>&nbsp;<img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="248" alt="image" src="http://sharepointsharpener.files.wordpress.com/2008/08/image12.png?w=579&#038;h=248" width="579" border="0"> </p>
<p>&nbsp;</p>
<p>Note that <em>Category</em>, <em>WebDisplayName</em> and<em> WebDescription</em> are optional but they do make your custom property much more readable for the end user.</p>
<p>In the above example, <em>propEmail</em> contains the default value of the property.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sharepointsharpener.wordpress.com/36/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sharepointsharpener.wordpress.com/36/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sharepointsharpener.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sharepointsharpener.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sharepointsharpener.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sharepointsharpener.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sharepointsharpener.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sharepointsharpener.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sharepointsharpener.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sharepointsharpener.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sharepointsharpener.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sharepointsharpener.wordpress.com/36/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sharepointsharpener.wordpress.com&blog=4068218&post=36&subd=sharepointsharpener&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sharepointsharpener.wordpress.com/2008/08/04/custom-properties-in-a-sharepoint-web-part/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0dfb315d39c37443371df076767fa665?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">thomassondergaard</media:title>
		</media:content>

		<media:content url="http://sharepointsharpener.files.wordpress.com/2008/08/image10.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://sharepointsharpener.files.wordpress.com/2008/08/image11.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://sharepointsharpener.files.wordpress.com/2008/08/image12.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
	</channel>
</rss>