<?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>Devblog of Bart Snyckers</title>
	<atom:link href="http://spbartnet.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://spbartnet.wordpress.com</link>
	<description>My thoughts and experience in ASP.NET and SharePoint development.</description>
	<lastBuildDate>Tue, 05 Jul 2011 11:36:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='spbartnet.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Devblog of Bart Snyckers</title>
		<link>http://spbartnet.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://spbartnet.wordpress.com/osd.xml" title="Devblog of Bart Snyckers" />
	<atom:link rel='hub' href='http://spbartnet.wordpress.com/?pushpress=hub'/>
		<item>
		<title>$SharePoint.Project.AssemblyFullName$ not resolving</title>
		<link>http://spbartnet.wordpress.com/2011/07/05/sharepoint-project-assemblyfullname-not-resolving/</link>
		<comments>http://spbartnet.wordpress.com/2011/07/05/sharepoint-project-assemblyfullname-not-resolving/#comments</comments>
		<pubDate>Tue, 05 Jul 2011 11:36:02 +0000</pubDate>
		<dc:creator>Bart Snyckers</dc:creator>
				<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[Assembly]]></category>

		<guid isPermaLink="false">http://spbartnet.wordpress.com/?p=156</guid>
		<description><![CDATA[If your assembly reference to $SharePoint.Project.AssemblyFullName$, for example in your master page, is not resolved when building the package, you have to edit the project file. Under the correct property group make sure the following line is in: &#60;TokenReplacementFileExtensions&#62;master&#60;/TokenReplacementFileExtensions&#62; Reload the project, rebuild the solution and create the package.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=spbartnet.wordpress.com&amp;blog=5121270&amp;post=156&amp;subd=spbartnet&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If your assembly reference to $SharePoint.Project.AssemblyFullName$, for example in your master page, is not resolved when building the package, you have to edit the project file. Under the correct property group make sure the following line is in:</p>
<pre>&lt;TokenReplacementFileExtensions&gt;master&lt;/TokenReplacementFileExtensions&gt;</pre>
<p>Reload the project, rebuild the solution and create the package.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/spbartnet.wordpress.com/156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/spbartnet.wordpress.com/156/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/spbartnet.wordpress.com/156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/spbartnet.wordpress.com/156/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/spbartnet.wordpress.com/156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/spbartnet.wordpress.com/156/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/spbartnet.wordpress.com/156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/spbartnet.wordpress.com/156/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/spbartnet.wordpress.com/156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/spbartnet.wordpress.com/156/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/spbartnet.wordpress.com/156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/spbartnet.wordpress.com/156/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/spbartnet.wordpress.com/156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/spbartnet.wordpress.com/156/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=spbartnet.wordpress.com&amp;blog=5121270&amp;post=156&amp;subd=spbartnet&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://spbartnet.wordpress.com/2011/07/05/sharepoint-project-assemblyfullname-not-resolving/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/de06ff097f1c55d2a479790c5508d197?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bartsnyckers</media:title>
		</media:content>
	</item>
		<item>
		<title>Open link under Site Actions in modal dialog</title>
		<link>http://spbartnet.wordpress.com/2010/11/10/open-link-under-site-actions-in-modal-dialog/</link>
		<comments>http://spbartnet.wordpress.com/2010/11/10/open-link-under-site-actions-in-modal-dialog/#comments</comments>
		<pubDate>Wed, 10 Nov 2010 09:44:41 +0000</pubDate>
		<dc:creator>Bart Snyckers</dc:creator>
				<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[Custom Action]]></category>
		<category><![CDATA[Modal Dialog]]></category>

		<guid isPermaLink="false">https://spbartnet.wordpress.com/2010/11/10/open-link-under-site-actions-in-modal-dialog/</guid>
		<description><![CDATA[Since SharePoint 2010, they introduced the modal dialog. This fancy screen is noticed by many and people start thinking in terms of it. So I got a request to make a new site provisioning system where the user gets a link under site actions which opens in a modal dialog. After some google requests I [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=spbartnet.wordpress.com&amp;blog=5121270&amp;post=151&amp;subd=spbartnet&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Since SharePoint 2010, they introduced the modal dialog. This fancy screen is noticed by many and people start thinking in terms of it. So I got a request to make a new site provisioning system where the user gets a link under site actions which opens in a modal dialog. After some google requests I came up on two sites which could help me. First of all <a href="http://www.chakkaradeep.com/page/about.aspx">Chankaradeep Chandran</a> posted something about ‘<a href="http://www.chakkaradeep.com/post/Using-the-SharePoint-2010-Modal-Dialog.aspx">Using the SharePoint 2010 Modal Dialog</a>’. Still I got a problem, how to get those files on SharePoint. So I ended up with the second post from a good friend, <a href="http://weblogs.asp.net/jan/about.aspx">Jan Tielens</a>. He posted in March an article about ‘<a href="http://weblogs.asp.net/jan/archive/2010/03/01/scriptsrc-referencing-javascript-files-with-sharepoint-2010-custom-actions.aspx">Referencing Javascript files with SharePoint 2010 Custom Actions using ScriptSrc</a>’.</p>
<p>I combined the knowledge and insights of both posts into a solution for my problem. First of all you have to start a Project scoped as Farm Solution since we have to publish files into the Layouts folder. This javascript file can be added into the Layouts Mapped Folder very easy.</p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:&#039;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;" id="codeSnippet">
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum1">   1:</span> <span style="color:#0000ff;">function</span> google_OpenModalDialog() {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum2">   2:</span>     <span style="color:#0000ff;">var</span> options = SP.UI.$create_DialogOptions();</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum3">   3:</span>     options.width = 500;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum4">   4:</span>     options.height = 250;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum5">   5:</span>     options.url = <span style="color:#006080;">&quot;http://www.google.com/&quot;</span>;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum6">   6:</span>     SP.UI.ModalDialog.showModalDialog(options);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum7">   7:</span> }</pre>
<p><!--CRLF--></div>
</div>
<p>To publish the file in SharePoint, so you can reference methods of it you have to add a CustomAction.</p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:&#039;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;" id="codeSnippet">
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum1">   1:</span> <span style="color:#0000ff;">&lt;</span><span style="color:#800000;">CustomAction</span> <span style="color:#ff0000;">Location</span><span style="color:#0000ff;">=&quot;ScriptLink&quot;</span> <span style="color:#ff0000;">Sequence</span><span style="color:#0000ff;">=&quot;1000&quot;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum2">   2:</span>               <span style="color:#ff0000;">ScriptSrc</span><span style="color:#0000ff;">=&quot;PlayingWithSiteActions/OpenModalDialog.js&quot;</span><span style="color:#0000ff;">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum3">   3:</span> <span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">CustomAction</span><span style="color:#0000ff;">&gt;</span></pre>
<p><!--CRLF--></div>
</div>
<p>Finally you can add another CustomAction to display a link under Site Actions a reference the javascript method when clicked on it.</p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:&#039;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;" id="codeSnippet">
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum1">   1:</span> <span style="color:#0000ff;">&lt;</span><span style="color:#800000;">CustomAction</span> <span style="color:#ff0000;">Id</span><span style="color:#0000ff;">=&quot;SiteActionsToolbar&quot;</span> <span style="color:#ff0000;">GroupId</span><span style="color:#0000ff;">=&quot;SiteActions&quot;</span> <span style="color:#ff0000;">Location</span><span style="color:#0000ff;">=&quot;Microsoft.SharePoint.StandardMenu&quot;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum2">   2:</span>               <span style="color:#ff0000;">Sequence</span><span style="color:#0000ff;">=&quot;1001&quot;</span> <span style="color:#ff0000;">Title</span><span style="color:#0000ff;">=&quot;Open Google&quot;</span><span style="color:#0000ff;">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum3">   3:</span>     <span style="color:#0000ff;">&lt;</span><span style="color:#800000;">UrlAction</span> <span style="color:#ff0000;">Url</span><span style="color:#0000ff;">=&quot;javascript:google_OpenModalDialog();&quot;</span> <span style="color:#0000ff;">/&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum4">   4:</span> <span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">CustomAction</span><span style="color:#0000ff;">&gt;</span></pre>
<p><!--CRLF--></div>
</div>
<p>Thanks to Jan and Chankaradeep for their part in my research.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/spbartnet.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/spbartnet.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/spbartnet.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/spbartnet.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/spbartnet.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/spbartnet.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/spbartnet.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/spbartnet.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/spbartnet.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/spbartnet.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/spbartnet.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/spbartnet.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/spbartnet.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/spbartnet.wordpress.com/151/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=spbartnet.wordpress.com&amp;blog=5121270&amp;post=151&amp;subd=spbartnet&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://spbartnet.wordpress.com/2010/11/10/open-link-under-site-actions-in-modal-dialog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/de06ff097f1c55d2a479790c5508d197?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bartsnyckers</media:title>
		</media:content>
	</item>
		<item>
		<title>Resource object not found</title>
		<link>http://spbartnet.wordpress.com/2010/06/21/resource-object-not-found/</link>
		<comments>http://spbartnet.wordpress.com/2010/06/21/resource-object-not-found/#comments</comments>
		<pubDate>Mon, 21 Jun 2010 13:17:46 +0000</pubDate>
		<dc:creator>Bart Snyckers</dc:creator>
				<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[copyappbincontent]]></category>
		<category><![CDATA[resource object not found]]></category>

		<guid isPermaLink="false">http://spbartnet.wordpress.com/?p=148</guid>
		<description><![CDATA[Today we got a new solution from a third party, which we installed on our development environment with the help of the supplier. Everything worked fine, but when we installed it on our test environment, it kept complaining that a resource object was not found (&#8220;The resource object with key &#8216;X&#8217; was not found.&#8221;). We [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=spbartnet.wordpress.com&amp;blog=5121270&amp;post=148&amp;subd=spbartnet&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Today we got a new solution from a third party, which we installed on our development environment with the help of the supplier. Everything worked fine, but when we installed it on our test environment, it kept complaining that a resource object was not found (&#8220;The resource object with key &#8216;X&#8217; was not found.&#8221;). We ran the stsadm -o copyappbincontent but it was still an error. We checked the resource directory in the 12-hive and the virtual directories in the inetpub folder and everything was present. Eventually we deleted the resource files inside the virtual directories and ran the copyappbincontent command again and yes, it worked. Strange problem, but since this solution was not found on the internet by me, I thought let&#8217;s share it.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/spbartnet.wordpress.com/148/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/spbartnet.wordpress.com/148/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/spbartnet.wordpress.com/148/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/spbartnet.wordpress.com/148/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/spbartnet.wordpress.com/148/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/spbartnet.wordpress.com/148/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/spbartnet.wordpress.com/148/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/spbartnet.wordpress.com/148/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/spbartnet.wordpress.com/148/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/spbartnet.wordpress.com/148/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/spbartnet.wordpress.com/148/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/spbartnet.wordpress.com/148/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/spbartnet.wordpress.com/148/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/spbartnet.wordpress.com/148/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=spbartnet.wordpress.com&amp;blog=5121270&amp;post=148&amp;subd=spbartnet&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://spbartnet.wordpress.com/2010/06/21/resource-object-not-found/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/de06ff097f1c55d2a479790c5508d197?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bartsnyckers</media:title>
		</media:content>
	</item>
		<item>
		<title>Styling your WebParts with CSS</title>
		<link>http://spbartnet.wordpress.com/2010/06/10/styling-your-webparts-with-css/</link>
		<comments>http://spbartnet.wordpress.com/2010/06/10/styling-your-webparts-with-css/#comments</comments>
		<pubDate>Thu, 10 Jun 2010 09:01:57 +0000</pubDate>
		<dc:creator>Bart Snyckers</dc:creator>
				<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[pagelayouts]]></category>
		<category><![CDATA[webparts]]></category>
		<category><![CDATA[webpartzones]]></category>

		<guid isPermaLink="false">http://spbartnet.wordpress.com/?p=145</guid>
		<description><![CDATA[I often get the requirement from the business to draw borders around all webparts, change the background color of specific webparts or even other styling issues. After the first prototype, they often change their mind and tell you which zones (best case) or even which webparts (worst case) they want styled and which not. At [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=spbartnet.wordpress.com&amp;blog=5121270&amp;post=145&amp;subd=spbartnet&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I often get the requirement from the business to draw borders around all webparts, change the background color of specific webparts or even other styling issues. After the first prototype, they often change their mind and tell you which zones (best case) or even which webparts (worst case) they want styled and which not. At first it looks like a challenging problem, but with todays cascading stylesheets you can do a lot. Let me demonstrate this with some examples.</p>
<p><span id="more-145"></span></p>
<p><strong>CSS refreshment</strong></p>
<p>Let me first introduce those who are not familiar with CSS to some basic selection rules &#8230;</p>
<ul>
<li>htmltag : apply style to all elements of a specific type (or htmltag)  (styling via html element)</li>
<li>#someid : apply style to all elements with an id attribute like someid (styling via html attribute id)</li>
<li>.someclass : apply style to all elements with a class attribute containing someclass (styling via html attribute class)</li>
</ul>
<p>and some more advanced rules &#8230;</p>
<ul>
<li>td.someclass : apply style to all td elements with a class attribute containing someclass</li>
<li>.someclass td : apply style to all td elements which are siblings from a html element with a class attribute containing someclass</li>
<li>table.someclass td : apply style to all td elements which are siblings from a table element with a class attribute containing someclass</li>
</ul>
<p>and finally some selectors where we filter an the attribute values &#8230;</p>
<ul>
<li>[attribute] : apply style whenever an element has this attribute, no matter what it&#8217;s value is</li>
<li>[attribute=somevalue] : apply style whenever an element has this attribute with the specified value</li>
<li>[attribute~=somevalue] : apply style whenever an element has this attribute and contains somevalue (the values have to be space separated words)</li>
<li>[attribute|=somevalue] : apply style whenever an element has this attribute and somevalue is in it (the values have to be hyphen separated words)</li>
<li>[attribute^=somevalue] : apply style whenever an element has this attribute and his value starts with somevalue</li>
<li>[attribute$=somevalue] : apply style whenever an element has this attribute and his value ends with somevalue</li>
</ul>
<p>You can find more CSS tutorials and samples on the internet.</p>
<p><strong>Styling the WebPartZones</strong></p>
<p>We use the out-of-the-box pagelayout &#8216;Blank Web Part Page&#8217; to style the Web Part zones. If you look at the source of the page, you will notice that every zone starts with a table cell (td) and has an id and name, &#8216;_invisibleIfEmpty&#8217;. A simple style to draw a border around every zone is:</p>
<p>td[id=_invisibleIfEmpty] { border: solid 1px #000000; } or td[name=_invisibleIfEmpty] { border: solid 1px #000000; }</p>
<p>If we want to style only the webparts in a specific zone, we will have to alter the pagelayout. Go the the page layout library, download a copy, make some changes and upload it again. Or better, create your own page layouts and page content types and publish these to the site collection. Let&#8217;s add a class, borders, in the &#8216;Blank Web Part Page&#8217; page layout to the webpart zones &#8216;Center Left&#8217;, &#8216;Center&#8217; and &#8216;Center Right&#8217; by adding a class attribute with the value borders to the td&#8217;s. Change the CSS definitions to:</p>
<p>td.borders[id=_invisibleIfEmpty] { border: solid 1px #000000; } or td.borders[name=_invisibleIfEmpty] { border: solid 1px #000000; }</p>
<p><strong>Styling the WebParts</strong></p>
<p>Those who take a closer look at the source code of a page with some webparts on it, will notice that the parent table of every web part has an attribute TOPLEVEL. To style a border for example around every webpart (including the title and content) you can start with a very simple CSS definition:</p>
<p>table[TOPLEVEL] { border: solid 1px #000000; }</p>
<p>To address specific webparts, for example in a zone, you can change the page layout like described before and add the class before the definition:</p>
<p>.borders table[TOPLEVEL] { border: solid 1px #000000; }</p>
<p>The table with the TOPLEVEL attribute contains two rows, one for the title and one for the content of the webpart. The title resp. content have a specific class ms-WPHeader resp. ms-WPBody. These classes can be used to style the title and content:</p>
<p>.ms-WPHeader { background-color: yellow; } resp. ms-WPBody { background-color: yellow; }</p>
<p>If you dive deeper, you will notice that the title row has a td with a title attribute. This way you can even style individual webparts (as long as the title stays the same) with the following CSS definition:</p>
<p>.ms-WPHeader[title="sometitle"] { background-color: blue; }</p>
<p>There is even a class for the h3 html element specific for webparts, nl ms-WPTitle.</p>
<p><strong>Conclusion</strong></p>
<p>Styling all zones or webparts is rather simple and costs a minimal of time. Once you get some specific requirements for webparts or zones, you have to dive into the page layouts and webparts. Styling custom build webparts gives you more flexibility, but you will often notice that they want to use OOTB and Custom webparts together and style them all the same way. This can be accomplished with some more work, but is not undoable.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/spbartnet.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/spbartnet.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/spbartnet.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/spbartnet.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/spbartnet.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/spbartnet.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/spbartnet.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/spbartnet.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/spbartnet.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/spbartnet.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/spbartnet.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/spbartnet.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/spbartnet.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/spbartnet.wordpress.com/145/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=spbartnet.wordpress.com&amp;blog=5121270&amp;post=145&amp;subd=spbartnet&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://spbartnet.wordpress.com/2010/06/10/styling-your-webparts-with-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/de06ff097f1c55d2a479790c5508d197?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bartsnyckers</media:title>
		</media:content>
	</item>
		<item>
		<title>Session State behaving strange</title>
		<link>http://spbartnet.wordpress.com/2010/05/26/session-state-behaving-strange/</link>
		<comments>http://spbartnet.wordpress.com/2010/05/26/session-state-behaving-strange/#comments</comments>
		<pubDate>Wed, 26 May 2010 13:50:46 +0000</pubDate>
		<dc:creator>Bart Snyckers</dc:creator>
				<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[Enable Session State]]></category>
		<category><![CDATA[nothing]]></category>
		<category><![CDATA[null]]></category>
		<category><![CDATA[Session]]></category>

		<guid isPermaLink="false">http://spbartnet.wordpress.com/?p=143</guid>
		<description><![CDATA[I lost several hours on a problem that what solved by something very simple but unexplainable from my side. I had to create a new MasterPage for our MySites. On the root site collection of the MySites WebApplication we published some custom application pages to extend the standard functionality. These pages used the session state [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=spbartnet.wordpress.com&amp;blog=5121270&amp;post=143&amp;subd=spbartnet&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I lost several hours on a problem that what solved by something very simple but unexplainable from my side. I had to create a new MasterPage for our MySites. On the root site collection of the MySites WebApplication we published some custom application pages to extend the standard functionality. These pages used the session state (HTTPContext.Current.Session) to store their model. Everything worked fine with the old MasterPage, but as soon as I selected the new one, the Edit Profile page started complaining that the SessionState was empty. I checked lots of things, even copied the old MasterPage sourcecode into the new MasterPage which didn&#8217;t worked neither. After lots of google links, a lot of frustration, even opening IIS, web.config files, trust configs, etc I found the solution on an other blog (lucky for me I&#8217;m not alone). Because it took me quite some links to read, I repost the solution here.</p>
<p>- If you get a HttpContext.Current.Session is nothing or HttpContext.Current.Session is null.<br />
- If a page gives you &#8220;Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive&#8221; and you&#8217;re absolutely sure you did this and other things Microsoft recommends to use Session State in SharePoint.<br />
- If you have enabled Session State through SharePoint Central Administration.<br />
- When you try to set the EnableSessionState attribute on the Page directive of your Application Page and the following error comes back: &#8220;The enablesessionstate attribute on the page directive is not allowed in this page.&#8221;.</p>
<p>Then just use the &#8216;<strong>Reset to site definition</strong>&#8216; in your Site Settings of your Site Collection. Simple isn&#8217;t? What is it doing, well send an email to Microsoft, because I can&#8217;t tell you, but it fixed the problem for me.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/spbartnet.wordpress.com/143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/spbartnet.wordpress.com/143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/spbartnet.wordpress.com/143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/spbartnet.wordpress.com/143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/spbartnet.wordpress.com/143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/spbartnet.wordpress.com/143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/spbartnet.wordpress.com/143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/spbartnet.wordpress.com/143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/spbartnet.wordpress.com/143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/spbartnet.wordpress.com/143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/spbartnet.wordpress.com/143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/spbartnet.wordpress.com/143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/spbartnet.wordpress.com/143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/spbartnet.wordpress.com/143/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=spbartnet.wordpress.com&amp;blog=5121270&amp;post=143&amp;subd=spbartnet&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://spbartnet.wordpress.com/2010/05/26/session-state-behaving-strange/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/de06ff097f1c55d2a479790c5508d197?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bartsnyckers</media:title>
		</media:content>
	</item>
		<item>
		<title>Mimicking the Workspace column of an Event Item (Part 2)</title>
		<link>http://spbartnet.wordpress.com/2010/01/21/mimicking-the-workspace-column-of-an-event-item-part-2/</link>
		<comments>http://spbartnet.wordpress.com/2010/01/21/mimicking-the-workspace-column-of-an-event-item-part-2/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 14:58:24 +0000</pubDate>
		<dc:creator>Bart Snyckers</dc:creator>
				<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[Custom Field Editor]]></category>
		<category><![CDATA[SPField]]></category>

		<guid isPermaLink="false">http://spbartnet.wordpress.com/?p=135</guid>
		<description><![CDATA[In &#8216;Mimicking the Workspace column of an Event Item (Part 1)&#8216;, I noted that it would not work if you use the custom field type from the UI. After some research, it seemed that SP2 for SharePoint 2007 created this problem. If you install the hotfix from August 2009 or even October 2009, the problem [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=spbartnet.wordpress.com&amp;blog=5121270&amp;post=135&amp;subd=spbartnet&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In &#8216;<a title="http://spbartnet.wordpress.com/2010/01/13/mimicking-the-workspace-column-of-an-event-item-part-1-3/#more-127" href="http://spbartnet.wordpress.com/2010/01/13/mimicking-the-workspace-column-of-an-event-item-part-1-3/#more-127" target="_blank">Mimicking the Workspace column of an Event Item (Part 1)</a>&#8216;, I noted that it would not work if you use the custom field type from the UI. After some research, it seemed that SP2 for SharePoint 2007 created this problem. If you install the hotfix from <a title="August 2009" href="http://support.microsoft.com/kb/973400" target="_blank">August 2009</a> or even <a title="October 2009" href="http://support.microsoft.com/kb/974989" target="_blank">October 2009</a>, the problem is solved.</p>
<p><strong>Correction previous post:</strong> The override of the FieldRenderingControl can be skipped as well. The standard rendering of a SPFieldUrl is sufficient.</p>
<p><span id="more-135"></span>In this post, I will describe how to make your self a custom field editor. You probably saw that SharePoint renders the controls itself if you edit the list column. Although it is working, to me it doesn&#8217;t look nice. It&#8217;s not that much work to make your own sections and display the properties of the field when editing.</p>
<p>First of all, you have to set the Hidden attribute of the properties to TRUE in the field type definition property schema. Next, you have to add a user control to the CONTROLTEMPLATES folder, in which you will add the custom sections. Refer to a class file which inherits from the IFieldEditor, register the necessary tag prefixes and add two input form sections like below.</p>
<p><span style="color:#0000ff;">&lt;</span><span style="color:#800000;">wssuc</span><span style="color:#0000ff;">:</span><span style="color:#0000ff;"><span style="color:#800000;">InputFormSection</span> </span><span style="color:#0000ff;"><span style="color:#ff0000;">runat</span>=&#8221;server&#8221; <span style="color:#ff0000;">id</span>=&#8221;ifsImages&#8221; <span style="color:#ff0000;">Title</span>=&#8221;Image settings&#8221; <span style="color:#ff0000;">Description</span>=&#8221;Set the header image and item image.&#8221;&gt;</span><br />
&nbsp;&nbsp;<span style="color:#0000ff;">&lt;</span><span style="color:#800000;">template_inputformcontrols</span><span style="color:#0000ff;">&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">&lt;</span><span style="color:#800000;">wssuc</span><span style="color:#0000ff;">:<span style="color:#800000;">InputFormControl</span> <span style="color:#ff0000;">runat</span>=&#8221;server&#8221; <span style="color:#ff0000;">LabelText</span>=&#8221;Header image:&#8221;&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">&lt;<span style="color:#800000;">Template_Control</span>&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">&lt;<span style="color:#800000;">asp</span>:<span style="color:#800000;">TextBox</span> <span style="color:#ff0000;">ID</span>=&#8221;tbHeaderImage&#8221; <span style="color:#ff0000;">runat</span>=&#8221;server&#8221; <span style="color:#ff0000;">Width</span>=&#8221;280&#8243;&gt;&lt;/<span style="color:#800000;">asp</span>:<span style="color:#800000;">TextBox</span>&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">&lt;/<span style="color:#800000;">Template_Control</span>&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">&lt;/<span style="color:#800000;">wssuc</span>:<span style="color:#800000;">InputFormControl</span>&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">&lt;<span style="color:#800000;">wssuc</span>:<span style="color:#800000;">InputFormControl</span> <span style="color:#ff0000;">runat</span>=&#8221;server&#8221; <span style="color:#ff0000;">LabelText</span>=&#8221;Item image:&#8221;&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">&lt;<span style="color:#800000;">Template_Control</span>&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">&lt;<span style="color:#800000;">asp</span>:<span style="color:#800000;">TextBox</span> <span style="color:#ff0000;">ID</span>=&#8221;tbItemImage&#8221; <span style="color:#ff0000;">runat</span>=&#8221;server&#8221; <span style="color:#ff0000;">Width</span>=&#8221;280&#8243;&gt;&lt;/<span style="color:#800000;">asp</span>:<span style="color:#800000;">TextBox</span>&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">&lt;/<span style="color:#800000;">Template_Control</span>&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">&lt;/<span style="color:#800000;">wssuc</span>:<span style="color:#800000;">InputFormControl</span>&gt;</span><br />
&nbsp;&nbsp;<span style="color:#0000ff;">&lt;/<span style="color:#800000;">template_inputformcontrols</span>&gt;</span><br />
<span style="color:#0000ff;">&lt;/<span style="color:#800000;">wssuc</span>:<span style="color:#800000;">InputFormSection</span>&gt;</span><br />
<span style="color:#0000ff;">&lt;<span style="color:#800000;">wssuc</span>:<span style="color:#800000;">InputFormSection</span> <span style="color:#ff0000;">runat</span>=&#8221;server&#8221; <span style="color:#ff0000;">id</span>=&#8221;ifsLink&#8221; <span style="color:#ff0000;">Title</span>=&#8221;Link settings&#8221; <span style="color:#ff0000;">Description</span>=&#8221;Specify if you want to see the description and want to open the link in a new window.&#8221;&gt;</span><br />
&nbsp;&nbsp;<span style="color:#0000ff;">&lt;<span style="color:#800000;">template_inputformcontrols</span>&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">&lt;<span style="color:#800000;">wssuc</span>:<span style="color:#800000;">InputFormControl</span> <span style="color:#ff0000;">runat</span>=&#8221;server&#8221; <span style="color:#ff0000;">LabelText</span>=&#8221;Show description:&#8221;&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">&lt;<span style="color:#800000;">Template_Control</span>&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">&lt;<span style="color:#800000;">asp</span>:<span style="color:#800000;">CheckBox</span> <span style="color:#ff0000;">ID</span>=&#8221;cbShowDescription&#8221; <span style="color:#ff0000;">runat</span>=&#8221;server&#8221; /&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">&lt;/<span style="color:#800000;">Template_Control</span>&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">&lt;/<span style="color:#800000;">wssuc</span>:<span style="color:#800000;">InputFormControl</span>&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">&lt;<span style="color:#800000;">wssuc</span>:<span style="color:#800000;">InputFormControl</span> <span style="color:#ff0000;">runat</span>=&#8221;server&#8221; <span style="color:#ff0000;">LabelText</span>=&#8221;Open link in new window:&#8221;&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">&lt;<span style="color:#800000;">Template_Control</span>&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">&lt;<span style="color:#800000;">asp</span>:<span style="color:#800000;">CheckBox</span> <span style="color:#ff0000;">ID</span>=&#8221;cbOpenLinkInNewWindow&#8221; <span style="color:#ff0000;">runat</span>=&#8221;server&#8221; /&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">&lt;/<span style="color:#800000;">Template_Control</span>&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">&lt;/<span style="color:#800000;">wssuc</span>:<span style="color:#800000;">InputFormControl</span>&gt;</span><br />
&nbsp;&nbsp;<span style="color:#0000ff;">&lt;/<span style="color:#800000;">template_inputformcontrols</span>&gt;</span><br />
<span style="color:#0000ff;">&lt;/<span style="color:#800000;">wssuc</span>:<span style="color:#800000;">InputFormSection</span>&gt;</span></p>
<p>In the CustomFieldEditor class, you define the web controls and for each web control a private property to store the selected value. Override the CreateChildControls and assign the selected values to the web controls.</p>
<p>tbHeaderImage.Text = selectedHeaderImage<br />
tbItemImage.Text = selectedItemImage<br />
cbShowDescription.Checked = selectedShowDescription<br />
cbOpenLinkInNewWindow.Checked = selectedOpenLinkInNewWindow</p>
<p>Implement the DisplayAsNewSection, InitializeWithField and OnSaveChange methods. The first method just returns true, while in the second, you will map the field properties to the field editor properties.</p>
<p><span style="color:#0000ff;">Dim </span>iwuf <span style="color:#0000ff;">As </span>ImageWithUrlField = <span style="color:#0000ff;">CType</span>(field, ImageWithUrlField)<br />
selectedHeaderImage = iwuf.HeaderImage<br />
selectedItemImage = iwuf.ItemImage<br />
selectedShowDescription = iwuf.ShowDescription<br />
selectedOpenLinkInNewWindow = iwuf.OpenLinkInNewWindow</p>
<p>In the OnSaveChange method, we have to set the selected variables, but this time with the values coming from the web controls and additionally update the values of the field. Get a reference to the field and update or set (first time) the properties.</p>
<p>selectedHeaderImage = tbHeaderImage.Text<br />
selectedItemImage = tbItemImage.Text<br />
selectedShowDescription = cbShowDescription.Checked<br />
selectedOpenLinkInNewWindow = cbOpenLinkInNewWindow.Checked</p>
<p><span style="color:#0000ff;">Dim </span>iwuf <span style="color:#0000ff;">As </span>ImageWithUrlField = <span style="color:#0000ff;">CType</span>(field, ImageWithUrlField)<br />
<span style="color:#0000ff;">If </span>isNewField <span style="color:#0000ff;">Then</span><br />
&nbsp;&nbsp;iwuf.UpdateHeaderImage(selectedHeaderImage)<br />
&nbsp;&nbsp;iwuf.UpdateItemImage(selectedItemImage)<br />
&nbsp;&nbsp;iwuf.UpdateShowDescription(selectedShowDescription)<br />
&nbsp;&nbsp;iwuf.UpdateOpenLinkInNewWindow(selectedOpenLinkInNewWindow)<br />
<span style="color:#0000ff;">Else</span><br />
&nbsp;&nbsp;iwuf.HeaderImage = selectedHeaderImage<br />
&nbsp;&nbsp;iwuf.ItemImage = selectedItemImage<br />
&nbsp;&nbsp;iwuf.ShowDescription = selectedShowDescription<br />
&nbsp;&nbsp;iwuf.OpenLinkInNewWindow = selectedOpenLinkInNewWindow<br />
<span style="color:#0000ff;">End If</span></p>
<p>Finally, we have to make some small adjustments to the field class. For each field property we have to add a dictionary with an integer and string and a private property. We also define an Update method for each property. Below it&#8217;s shown for the HeaderImage, the other are similar. For the context id we get the hashcode of the current context.</p>
<p><span style="color:#0000ff;">Private Shared </span>_headerImageDictionary <span style="color:#0000ff;">As </span>Dictionary(<span style="color:#0000ff;">Of Integer, String</span>) = _<br />
&nbsp;&nbsp;<span style="color:#0000ff;">New</span> Dictionary(Of Integer, String)<br />
<span style="color:#0000ff;">Private</span> _headerImage <span style="color:#0000ff;">As String</span><br />
<span style="color:#0000ff;">Public Sub</span> UpdateHeaderImage(<span style="color:#0000ff;">ByVal</span> value <span style="color:#0000ff;">As String</span>)<br />
&nbsp;&nbsp;_headerImageDictionary(ContextId) = value<br />
<span style="color:#0000ff;">End Sub</span><br />
<span style="color:#0000ff;">Public Property</span> HeaderImage() <span style="color:#0000ff;">As String</span><br />
&nbsp;&nbsp;<span style="color:#0000ff;">Get</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;Initialize()<br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">If</span> _headerImageDictionary.ContainsKey(ContextId) <span style="color:#0000ff;">Then</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_headerImage = _headerImageDictionary(ContextId)<br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">End If</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">Return</span> _headerImage<br />
&nbsp;&nbsp;<span style="color:#0000ff;">End Get</span><br />
&nbsp;&nbsp;<span style="color:#0000ff;">Set</span>(<span style="color:#0000ff;">ByVal</span> value <span style="color:#0000ff;">As String</span>)<br />
&nbsp;&nbsp;&nbsp;&nbsp;IsInitialized = True<br />
&nbsp;&nbsp;&nbsp;&nbsp;_headerImage = value<br />
&nbsp;&nbsp;<span style="color:#0000ff;">End Set</span><br />
<span style="color:#0000ff;">End Property</span></p>
<p>In the OnAdded method, below the base call, we add a new method call, Update(). This method and the Initialize method (from the properties) is needed to Set and Get the Custom Properties.</p>
<p><span style="color:#0000ff;">Public Overrides Sub</span> Update()<br />
&nbsp;&nbsp;SetCustomProperty(<span style="color:#800000;">&#8220;HeaderImage&#8221;</span>, HeaderImage)<br />
&nbsp;&nbsp;SetCustomProperty(<span style="color:#800000;">&#8220;ItemImage&#8221;</span>, ItemImage)<br />
&nbsp;&nbsp;SetCustomProperty(<span style="color:#800000;">&#8220;ShowDescription&#8221;</span>, ShowDescription.ToString())<br />
&nbsp;&nbsp;SetCustomProperty(<span style="color:#800000;">&#8220;OpenLinkInNewWindow&#8221;</span>, OpenLinkInNewWindow.ToString())</p>
<p>&nbsp;&nbsp;<span style="color:#0000ff;">MyBase</span>.Update()</p>
<p>&nbsp;&nbsp;<span style="color:#0000ff;">If</span> _headerImageDictionary.ContainsKey(ContextId) <span style="color:#0000ff;">Then</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;_headerImageDictionary.Remove(ContextId)<br />
&nbsp;&nbsp;<span style="color:#0000ff;">End If</span><br />
&nbsp;&nbsp;<span style="color:#0000ff;">If</span> _itemImageDictionary.ContainsKey(ContextId) <span style="color:#0000ff;">Then</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;_itemImageDictionary.Remove(ContextId)<br />
&nbsp;&nbsp;<span style="color:#0000ff;">End If</span><br />
&nbsp;&nbsp;<span style="color:#0000ff;">If</span> _showDescriptionDictionary.ContainsKey(ContextId) <span style="color:#0000ff;">Then</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;_showDescriptionDictionary.Remove(ContextId)<br />
&nbsp;&nbsp;<span style="color:#0000ff;">End If</span><br />
&nbsp;&nbsp;<span style="color:#0000ff;">If</span> _openLinkInNewWindowDictionary.ContainsKey(ContextId) <span style="color:#0000ff;">Then</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;_openLinkInNewWindowDictionary.Remove(ContextId)<br />
&nbsp;&nbsp;<span style="color:#0000ff;">End If</span><br />
<span style="color:#0000ff;"> End Sub</span></p>
<p><span style="color:#0000ff;">Private Sub</span> Initialize()<br />
&nbsp;&nbsp;<span style="color:#0000ff;">If</span> IsInitialized <span style="color:#0000ff;">Then</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">Exit Sub</span><br />
&nbsp;&nbsp;<span style="color:#0000ff;">End If</span></p>
<p>&nbsp;&nbsp;<span style="color:#0000ff;">If</span> GetCustomProperty(<span style="color:#800000;">&#8220;HeaderImage&#8221;</span>) <span style="color:#0000ff;">IsNot Nothing </span><span style="color:#0000ff;">Then</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;HeaderImage = GetCustomProperty(<span style="color:#800000;">&#8220;HeaderImage&#8221;</span>).ToString()<br />
&nbsp;&nbsp;<span style="color:#0000ff;">End If</span><br />
&nbsp;&nbsp;<span style="color:#0000ff;">If</span> GetCustomProperty(<span style="color:#800000;">&#8220;ItemImage&#8221;</span>) <span style="color:#0000ff;">IsNot Nothing </span><span style="color:#0000ff;">Then</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;ItemImage = GetCustomProperty(<span style="color:#800000;">&#8220;ItemImage&#8221;</span>).ToString()<br />
&nbsp;&nbsp;<span style="color:#0000ff;">End If</span><br />
&nbsp;&nbsp;<span style="color:#0000ff;">If</span> GetCustomProperty(<span style="color:#800000;">&#8220;ShowDescription&#8221;</span>) <span style="color:#0000ff;">IsNot Nothing </span><span style="color:#0000ff;">Then</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;ShowDescription = <span style="color:#0000ff;">CType</span>(GetCustomProperty(<span style="color:#800000;">&#8220;ShowDescription&#8221;</span>), <span style="color:#0000ff;">Boolean</span>)<br />
&nbsp;&nbsp;<span style="color:#0000ff;">End If</span><br />
&nbsp;&nbsp;<span style="color:#0000ff;">If</span> GetCustomProperty(<span style="color:#800000;">&#8220;OpenLinkInNewWindow&#8221;</span>) <span style="color:#0000ff;">IsNot Nothing </span><span style="color:#0000ff;">Then</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;OpenLinkInNewWindow = <span style="color:#0000ff;">CType</span>(GetCustomProperty(<span style="color:#800000;">&#8220;OpenLinkInNewWindow&#8221;</span>), <span style="color:#0000ff;">Boolean</span>)<br />
&nbsp;&nbsp;<span style="color:#0000ff;">End If</span></p>
<p>&nbsp;&nbsp;IsInitialized = <span style="color:#0000ff;">True</span><br />
<span style="color:#0000ff;">End Sub</span></p>
<p>Rebuild your project and upgrade the solution.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/spbartnet.wordpress.com/135/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/spbartnet.wordpress.com/135/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/spbartnet.wordpress.com/135/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/spbartnet.wordpress.com/135/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/spbartnet.wordpress.com/135/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/spbartnet.wordpress.com/135/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/spbartnet.wordpress.com/135/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/spbartnet.wordpress.com/135/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/spbartnet.wordpress.com/135/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/spbartnet.wordpress.com/135/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/spbartnet.wordpress.com/135/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/spbartnet.wordpress.com/135/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/spbartnet.wordpress.com/135/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/spbartnet.wordpress.com/135/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=spbartnet.wordpress.com&amp;blog=5121270&amp;post=135&amp;subd=spbartnet&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://spbartnet.wordpress.com/2010/01/21/mimicking-the-workspace-column-of-an-event-item-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/de06ff097f1c55d2a479790c5508d197?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bartsnyckers</media:title>
		</media:content>
	</item>
		<item>
		<title>jQuery :not</title>
		<link>http://spbartnet.wordpress.com/2010/01/15/jquery-not/</link>
		<comments>http://spbartnet.wordpress.com/2010/01/15/jquery-not/#comments</comments>
		<pubDate>Fri, 15 Jan 2010 08:28:11 +0000</pubDate>
		<dc:creator>Bart Snyckers</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[attribute filter]]></category>
		<category><![CDATA[basic filter]]></category>
		<category><![CDATA[not]]></category>

		<guid isPermaLink="false">http://spbartnet.wordpress.com/?p=132</guid>
		<description><![CDATA[Took me a while to figure this out, so I thought this might be useful for others too. I had to select all items where a certain text was not in the id of the tag. Very simple to select the opposite (those which contain the text in the id) with the following statement. $(&#8220;.item[id*='sometext']&#8220;); [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=spbartnet.wordpress.com&amp;blog=5121270&amp;post=132&amp;subd=spbartnet&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Took me a while to figure this out, so I thought this might be useful for others too. I had to select all items where a certain text was not in the id of the tag. Very simple to select the opposite (those which contain the text in the id) with the following statement.</p>
<p>$(&#8220;.item[id*='sometext']&#8220;);</p>
<p>First of all, jQuery doesn&#8217;t has an Attribute filter in the <a href="http://docs.jquery.com/Selectors" target="_blank">selectors</a> to select the opposite. They do have an inverse for the attribute filter &#8216;attr=value&#8217;, but this won&#8217;t work for &#8216;attr*=value&#8217;. So you have to work with the :not basic filter. The documentation and examples there say <a href="http://docs.jquery.com/Selectors/not#selector" target="_blank">:not(selector)</a>, so you would think that the following would work.</p>
<p>$(&#8220;:not(.item[id*='sometext'])&#8221;);</p>
<p>But I won&#8217;t, it just selects about anything. The only correct way is to move the :not just before the attribute filter like this.</p>
<p>$(&#8220;.item:not([id*='sometext'])&#8221;);</p>
<p>Seems simple once you know <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/spbartnet.wordpress.com/132/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/spbartnet.wordpress.com/132/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/spbartnet.wordpress.com/132/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/spbartnet.wordpress.com/132/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/spbartnet.wordpress.com/132/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/spbartnet.wordpress.com/132/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/spbartnet.wordpress.com/132/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/spbartnet.wordpress.com/132/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/spbartnet.wordpress.com/132/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/spbartnet.wordpress.com/132/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/spbartnet.wordpress.com/132/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/spbartnet.wordpress.com/132/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/spbartnet.wordpress.com/132/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/spbartnet.wordpress.com/132/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=spbartnet.wordpress.com&amp;blog=5121270&amp;post=132&amp;subd=spbartnet&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://spbartnet.wordpress.com/2010/01/15/jquery-not/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/de06ff097f1c55d2a479790c5508d197?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bartsnyckers</media:title>
		</media:content>
	</item>
		<item>
		<title>Mimicking the Workspace column of an Event Item (Part 1)</title>
		<link>http://spbartnet.wordpress.com/2010/01/13/mimicking-the-workspace-column-of-an-event-item-part-1-3/</link>
		<comments>http://spbartnet.wordpress.com/2010/01/13/mimicking-the-workspace-column-of-an-event-item-part-1-3/#comments</comments>
		<pubDate>Wed, 13 Jan 2010 17:28:41 +0000</pubDate>
		<dc:creator>Bart Snyckers</dc:creator>
				<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[Cross Project Link]]></category>
		<category><![CDATA[Event]]></category>
		<category><![CDATA[Hyperlink]]></category>
		<category><![CDATA[SPField]]></category>

		<guid isPermaLink="false">http://spbartnet.wordpress.com/2010/01/13/mimicking-the-workspace-column-of-an-event-item-part-1-3/</guid>
		<description><![CDATA[We got a request for a project to mimic the Workspace column of an Event Item, in that sense that they also wanted an icon in the header and an icon for the link value instead of the text. The site column, ‘Workspace’, and site content type, ‘Event’, are hidden in SharePoint. Besides that, the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=spbartnet.wordpress.com&amp;blog=5121270&amp;post=127&amp;subd=spbartnet&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>We got a request for a project to mimic the Workspace column of an Event Item, in that sense that they also wanted an icon in the header and an icon for the link value instead of the text. The site column, ‘Workspace’, and site content type, ‘Event’, are hidden in SharePoint. Besides that, the ‘Workspace’ column is of the ‘Cross Project Link’ field type, which isn’t available. This field type cannot be used via the user interface. Since we got two additional requirements, open link in new window and display description besides icon, we opted to inherit from the parent type ‘URL’. Via the user interface, this is the ‘Hyperlink or Picture’ type. For maximum reuse, we build a new field type with some custom properties and header and display pattern.</p>
<p> <span id="more-127"></span>
<p>First we defined the field type and called it an ‘Imagelink’. We also associated a field type class which we will define later.</p>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">Field</span> <span class="attr">Name</span><span class="kwrd">=&quot;TypeName&quot;</span><span class="kwrd">&gt;</span>Imagelink<span class="kwrd">&lt;/</span><span class="html">Field</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;</span><span class="html">Field</span> <span class="attr">Name</span><span class="kwrd">=&quot;TypeDisplayName&quot;</span><span class="kwrd">&gt;</span>Image with Url<span class="kwrd">&lt;/</span><span class="html">Field</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;</span><span class="html">Field</span> <span class="attr">Name</span><span class="kwrd">=&quot;TypeShortDescription&quot;</span><span class="kwrd">&gt;</span>Imagelink<span class="kwrd">&lt;/</span><span class="html">Field</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;</span><span class="html">Field</span> <span class="attr">Name</span><span class="kwrd">=&quot;ParentType&quot;</span><span class="kwrd">&gt;</span>URL<span class="kwrd">&lt;/</span><span class="html">Field</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;</span><span class="html">Field</span> <span class="attr">Name</span><span class="kwrd">=&quot;UserCreatable&quot;</span><span class="kwrd">&gt;</span>TRUE<span class="kwrd">&lt;/</span><span class="html">Field</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;</span><span class="html">Field</span> <span class="attr">Name</span><span class="kwrd">=&quot;ShowInListCreate&quot;</span><span class="kwrd">&gt;</span>TRUE<span class="kwrd">&lt;/</span><span class="html">Field</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;</span><span class="html">Field</span> <span class="attr">Name</span><span class="kwrd">=&quot;ShowInSurveyCreate&quot;</span><span class="kwrd">&gt;</span>FALSE<span class="kwrd">&lt;/</span><span class="html">Field</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;</span><span class="html">Field</span> <span class="attr">Name</span><span class="kwrd">=&quot;ShowInDocumentLibraryCreate&quot;</span><span class="kwrd">&gt;</span>TRUE<span class="kwrd">&lt;/</span><span class="html">Field</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;</span><span class="html">Field</span> <span class="attr">Name</span><span class="kwrd">=&quot;ShowInColumnTemplateCreate&quot;</span><span class="kwrd">&gt;</span>TRUE<span class="kwrd">&lt;/</span><span class="html">Field</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;</span><span class="html">Field</span> <span class="attr">Name</span><span class="kwrd">=&quot;FieldTypeClass&quot;</span><span class="kwrd">&gt;</span>Imagelink.Imagelink, Imagelink, …<span class="kwrd">&lt;/</span><span class="html">Field</span><span class="kwrd">&gt;</span></pre>
<p>Next we had to define some custom properties to store the image links and additional requirements (default values were set to images inside SharePoint out-of-the-box).</p>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">PropertySchema</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">Fields</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">Field</span> <span class="attr">Name</span><span class="kwrd">=&quot;HeaderImage&quot;</span> <span class="attr">DisplayName</span><span class="kwrd">=&quot;Header Image&quot;</span>
           <span class="attr">Hidden</span><span class="kwrd">=&quot;FALSE&quot;</span> <span class="attr">Type</span><span class="kwrd">=&quot;Text&quot;</span><span class="kwrd">&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">Default</span><span class="kwrd">&gt;</span>/_layouts/images/linktosite.gif<span class="kwrd">&lt;/</span><span class="html">Default</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;/</span><span class="html">Field</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">Field</span> <span class="attr">Name</span><span class="kwrd">=&quot;ItemImage&quot;</span> <span class="attr">DisplayName</span><span class="kwrd">=&quot;Item Image&quot;</span>
           <span class="attr">Hidden</span><span class="kwrd">=&quot;FALSE&quot;</span> <span class="attr">Type</span><span class="kwrd">=&quot;Text&quot;</span><span class="kwrd">&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">Default</span><span class="kwrd">&gt;</span>/_layouts/images/linktosite.gif<span class="kwrd">&lt;/</span><span class="html">Default</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;/</span><span class="html">Field</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">Field</span> <span class="attr">Name</span><span class="kwrd">=&quot;ShowDescription&quot;</span> <span class="attr">DisplayName</span><span class="kwrd">=&quot;Show description&quot;</span>
           <span class="attr">Hidden</span><span class="kwrd">=&quot;FALSE&quot;</span> <span class="attr">Type</span><span class="kwrd">=&quot;Boolean&quot;</span><span class="kwrd">&gt;&lt;/</span><span class="html">Field</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">Field</span> <span class="attr">Name</span><span class="kwrd">=&quot;OpenLinkInNewWindow&quot;</span> <span class="attr">DisplayName</span><span class="kwrd">=&quot;Open link in new window&quot;</span>
           <span class="attr">Hidden</span><span class="kwrd">=&quot;FALSE&quot;</span> <span class="attr">Type</span><span class="kwrd">=&quot;Boolean&quot;</span><span class="kwrd">&gt;&lt;/</span><span class="html">Field</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;/</span><span class="html">Fields</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">PropertySchema</span><span class="kwrd">&gt;</span></pre>
<p>To finish the ‘fldTypes_&#8230;’ xml file, we must implement the HeaderPattern and DisplayPattern.</p>
<p>The header pattern is pretty straight forward. If the HeaderImage custom property is not defined or empty, use the textual name of the field. In the other case, we build a HTML image tag and set the source and title attribute of this field.</p>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">RenderPattern</span> <span class="attr">Name</span><span class="kwrd">=&quot;HeaderPattern&quot;</span> <span class="attr">DisplayName</span><span class="kwrd">=&quot;HeaderPattern&quot;</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">Switch</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">Expr</span><span class="kwrd">&gt;&lt;</span><span class="html">Property</span> <span class="attr">Select</span><span class="kwrd">=&quot;HeaderImage&quot;</span> <span class="kwrd">/&gt;&lt;/</span><span class="html">Expr</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">Case</span> <span class="attr">Value</span><span class="kwrd">=&quot;&quot;</span><span class="kwrd">&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">Property</span> <span class="attr">Select</span><span class="kwrd">=&quot;DisplayName&quot;</span> <span class="attr">HTMLEncode</span><span class="kwrd">=&quot;TRUE&quot;</span> <span class="kwrd">/&gt;</span>
    <span class="kwrd">&lt;/</span><span class="html">Case</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">Default</span><span class="kwrd">&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">HTML</span><span class="kwrd">&gt;&lt;!</span>[CDATA[<span class="kwrd">&lt;</span><span class="html">img</span> <span class="attr">src</span>=&quot;]]<span class="kwrd">&gt;&lt;/</span><span class="html">HTML</span><span class="kwrd">&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">Property</span> <span class="attr">Select</span><span class="kwrd">=&quot;HeaderImage&quot;</span> <span class="kwrd">/&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">HTML</span><span class="kwrd">&gt;&lt;!</span>[CDATA[&quot; title=&quot;]]<span class="kwrd">&gt;&lt;/</span><span class="html">HTML</span><span class="kwrd">&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">Property</span> <span class="attr">Select</span><span class="kwrd">=&quot;DisplayName&quot;</span> <span class="attr">HTMLEncode</span><span class="kwrd">=&quot;TRUE&quot;</span> <span class="kwrd">/&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">HTML</span><span class="kwrd">&gt;&lt;!</span>[CDATA[&quot; <span class="kwrd">/&gt;</span>]]<span class="kwrd">&gt;&lt;/</span><span class="html">HTML</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;/</span><span class="html">Default</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;/</span><span class="html">Switch</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">RenderPattern</span><span class="kwrd">&gt;</span></pre>
<p>The display pattern is a bit more complex, since we have to readout the values of several custom properties. There are multiple switch statements:</p>
<pre class="csharpcode">1.    Check the <span class="kwrd">value</span> of the field (line 3), <span class="kwrd">if</span> empty display nothing
       and exit, <span class="kwrd">else</span> <span class="kwrd">continue</span>
2.    If <span class="kwrd">value</span> of the custom property ‘ItemImage’ (line 7) <span class="kwrd">is</span> empty
2.1.    Open the HTML Hyperlink opening tag and set the href attribute
2.2.    Check the <span class="kwrd">value</span> of the custom property ‘OpenLinkInNewWindow’
         (line 13-15)
2.2.1.    If <span class="kwrd">true</span>, add an extra attribute target and set it to _blank
2.3.    Close the HTML Hyperlink opening tag
2.4.    Print the description
2.5.    Print the HTML Hyperlink closing tag
3.    If <span class="kwrd">value</span> of the custom property ‘ItemImage’ (line 7) <span class="kwrd">is</span> not empty
3.1.    If <span class="kwrd">value</span> of the custom property ‘ShowDescription’ (line 26-28)
<span class="kwrd">         is</span> <span class="kwrd">true</span>
3.1.1.    Open the HTML Hyperlink opening tag and set the href
           attribute
3.1.2.    Check the <span class="kwrd">value</span> of the custom property
           ‘OpenLinkInNewWindow’ (line 34-36)
3.1.2.1.    If <span class="kwrd">true</span>, add an extra attribute target and set it to
             _blank
3.1.3.    Close the HTML Hyperlink opening tag
3.1.4.    Print the HTML Image tag and set border, style, source and
           title attribute
3.1.5.    Print the HTML Hyperlink closing tag
3.1.6.    Open a second HTML Hyperlink opening tag and set the
           href attribute
3.1.7.    Check the <span class="kwrd">value</span> of the custom property
           ‘OpenLinkInNewWindow’ (line 50-52)
3.1.7.1.    If <span class="kwrd">true</span>, add an extra attribute target and set it to
             _blank
3.1.8.    Close the HTML Hyperlink opening tag
3.1.9.    Print the HTML Hyperlink closing tag
3.2.    If <span class="kwrd">value</span> of the custom property ‘ShowDescription’ (line 26-28)
<span class="kwrd">         is</span> <span class="kwrd">false</span>
3.2.1.    Open the HTML Hyperlink opening tag and set the href
           attribute
3.2.2.    Check the <span class="kwrd">value</span> of the custom property
           ‘OpenLinkInNewWindow’ (line 66-68)
3.2.2.1.    If <span class="kwrd">true</span>, add an extra attribute target and set it to
             _blank
3.2.3.    Close the HTML Hyperlink opening tag
3.2.4.    Print the HTML Image tag and set border, source and title
           attribute
3.2.5.    Print the HTML Hyperlink closing tag </pre>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">RenderPattern</span> <span class="attr">Name</span><span class="kwrd">=&quot;DisplayPattern&quot;</span> <span class="attr">DisplayName</span><span class="kwrd">=&quot;DisplayPattern&quot;</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">Switch</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">Expr</span><span class="kwrd">&gt;&lt;</span><span class="html">Column</span> <span class="kwrd">/&gt;&lt;/</span><span class="html">Expr</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">Case</span> <span class="attr">Value</span><span class="kwrd">=&quot;&quot;</span><span class="kwrd">&gt;&lt;/</span><span class="html">Case</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">Default</span><span class="kwrd">&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">Switch</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">Expr</span><span class="kwrd">&gt;&lt;</span><span class="html">Property</span> <span class="attr">Select</span><span class="kwrd">=&quot;ItemImage&quot;</span> <span class="kwrd">/&gt;&lt;/</span><span class="html">Expr</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">Case</span> <span class="attr">Value</span><span class="kwrd">=&quot;&quot;</span><span class="kwrd">&gt;</span>
          <span class="kwrd">&lt;</span><span class="html">HTML</span><span class="kwrd">&gt;&lt;!</span>[CDATA[<span class="kwrd">&lt;</span><span class="html">a</span> <span class="attr">href</span>=&quot;]]<span class="kwrd">&gt;&lt;/</span><span class="html">HTML</span><span class="kwrd">&gt;</span>
          <span class="kwrd">&lt;</span><span class="html">Column</span> <span class="attr">HTMLEncode</span><span class="kwrd">=&quot;TRUE&quot;</span> <span class="kwrd">/&gt;</span>
          <span class="kwrd">&lt;</span><span class="html">HTML</span><span class="kwrd">&gt;&lt;!</span>[CDATA[&quot;]]<span class="kwrd">&gt;&lt;/</span><span class="html">HTML</span><span class="kwrd">&gt;</span>
          <span class="kwrd">&lt;</span><span class="html">Switch</span><span class="kwrd">&gt;</span>
            <span class="kwrd">&lt;</span><span class="html">Expr</span><span class="kwrd">&gt;</span>
              <span class="kwrd">&lt;</span><span class="html">Property</span> <span class="attr">Select</span><span class="kwrd">=&quot;OpenLinkInNewWindow&quot;</span> <span class="kwrd">/&gt;</span>
            <span class="kwrd">&lt;/</span><span class="html">Expr</span><span class="kwrd">&gt;</span>
            <span class="kwrd">&lt;</span><span class="html">Case</span> <span class="attr">Value</span><span class="kwrd">=&quot;True&quot;</span><span class="kwrd">&gt;</span>
              <span class="kwrd">&lt;</span><span class="html">HTML</span><span class="kwrd">&gt;&lt;!</span>[CDATA[ target=&quot;_blank&quot;]]<span class="kwrd">&gt;&lt;/</span><span class="html">HTML</span><span class="kwrd">&gt;</span>
            <span class="kwrd">&lt;/</span><span class="html">Case</span><span class="kwrd">&gt;</span>
          <span class="kwrd">&lt;/</span><span class="html">Switch</span><span class="kwrd">&gt;</span>
          <span class="kwrd">&lt;</span><span class="html">HTML</span><span class="kwrd">&gt;&lt;!</span>[CDATA[<span class="kwrd">&gt;</span>]]<span class="kwrd">&gt;&lt;/</span><span class="html">HTML</span><span class="kwrd">&gt;</span>
          <span class="kwrd">&lt;</span><span class="html">Column2</span> <span class="attr">HTMLEncode</span><span class="kwrd">=&quot;TRUE&quot;</span> <span class="kwrd">/&gt;</span>
          <span class="kwrd">&lt;</span><span class="html">HTML</span><span class="kwrd">&gt;&lt;!</span>[CDATA[<span class="kwrd">&lt;/</span><span class="html">a</span><span class="kwrd">&gt;</span>]]<span class="kwrd">&gt;&lt;/</span><span class="html">HTML</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;/</span><span class="html">Case</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">Default</span><span class="kwrd">&gt;</span>
          <span class="kwrd">&lt;</span><span class="html">Switch</span><span class="kwrd">&gt;</span>
            <span class="kwrd">&lt;</span><span class="html">Expr</span><span class="kwrd">&gt;</span>
              <span class="kwrd">&lt;</span><span class="html">Property</span> <span class="attr">Select</span><span class="kwrd">=&quot;ShowDescription&quot;</span> <span class="kwrd">/&gt;</span>
            <span class="kwrd">&lt;/</span><span class="html">Expr</span><span class="kwrd">&gt;</span>
            <span class="kwrd">&lt;</span><span class="html">Case</span> <span class="attr">Value</span><span class="kwrd">=&quot;True&quot;</span><span class="kwrd">&gt;</span>
              <span class="kwrd">&lt;</span><span class="html">HTML</span><span class="kwrd">&gt;&lt;!</span>[CDATA[<span class="kwrd">&lt;</span><span class="html">a</span> <span class="attr">href</span>=&quot;]]<span class="kwrd">&gt;&lt;/</span><span class="html">HTML</span><span class="kwrd">&gt;</span>
              <span class="kwrd">&lt;</span><span class="html">Column</span> <span class="attr">HTMLEncode</span><span class="kwrd">=&quot;TRUE&quot;</span> <span class="kwrd">/&gt;</span>
              <span class="kwrd">&lt;</span><span class="html">HTML</span><span class="kwrd">&gt;&lt;!</span>[CDATA[&quot;]]<span class="kwrd">&gt;&lt;/</span><span class="html">HTML</span><span class="kwrd">&gt;</span>
              <span class="kwrd">&lt;</span><span class="html">Switch</span><span class="kwrd">&gt;</span>
                <span class="kwrd">&lt;</span><span class="html">Expr</span><span class="kwrd">&gt;</span>
                  <span class="kwrd">&lt;</span><span class="html">Property</span> <span class="attr">Select</span><span class="kwrd">=&quot;OpenLinkInNewWindow&quot;</span> <span class="kwrd">/&gt;</span>
                <span class="kwrd">&lt;/</span><span class="html">Expr</span><span class="kwrd">&gt;</span>
                <span class="kwrd">&lt;</span><span class="html">Case</span> <span class="attr">Value</span><span class="kwrd">=&quot;True&quot;</span><span class="kwrd">&gt;</span>
                  <span class="kwrd">&lt;</span><span class="html">HTML</span><span class="kwrd">&gt;&lt;!</span>[CDATA[ target=&quot;_blank&quot;]]<span class="kwrd">&gt;&lt;/</span><span class="html">HTML</span><span class="kwrd">&gt;</span>
                <span class="kwrd">&lt;/</span><span class="html">Case</span><span class="kwrd">&gt;</span>
              <span class="kwrd">&lt;/</span><span class="html">Switch</span><span class="kwrd">&gt;</span>
              <span class="kwrd">&lt;</span><span class="html">HTML</span><span class="kwrd">&gt;&lt;!</span>[CDATA[<span class="kwrd">&gt;&lt;</span><span class="html">img</span> <span class="attr">border</span><span class="kwrd">=&quot;0&quot;</span> <span class="attr">style</span><span class="kwrd">=&quot;margin-right:5px;&quot;</span>
                     <span class="attr">src</span>=&quot;]]<span class="kwrd">&gt;&lt;/</span><span class="html">HTML</span><span class="kwrd">&gt;</span>
              <span class="kwrd">&lt;</span><span class="html">Property</span> <span class="attr">Select</span><span class="kwrd">=&quot;ItemImage&quot;</span> <span class="kwrd">/&gt;</span>
              <span class="kwrd">&lt;</span><span class="html">HTML</span><span class="kwrd">&gt;&lt;!</span>[CDATA[&quot; title=&quot;]]<span class="kwrd">&gt;&lt;/</span><span class="html">HTML</span><span class="kwrd">&gt;</span>
              <span class="kwrd">&lt;</span><span class="html">Column2</span> <span class="attr">HTMLEncode</span><span class="kwrd">=&quot;TRUE&quot;</span> <span class="kwrd">/&gt;</span>
              <span class="kwrd">&lt;</span><span class="html">HTML</span><span class="kwrd">&gt;&lt;!</span>[CDATA[&quot;<span class="kwrd">&gt;&lt;/</span><span class="html">a</span><span class="kwrd">&gt;</span>]]<span class="kwrd">&gt;&lt;/</span><span class="html">HTML</span><span class="kwrd">&gt;</span>
              <span class="kwrd">&lt;</span><span class="html">HTML</span><span class="kwrd">&gt;&lt;!</span>[CDATA[<span class="kwrd">&lt;</span><span class="html">a</span> <span class="attr">href</span>=&quot;]]<span class="kwrd">&gt;&lt;/</span><span class="html">HTML</span><span class="kwrd">&gt;</span>
              <span class="kwrd">&lt;</span><span class="html">Column</span> <span class="attr">HTMLEncode</span><span class="kwrd">=&quot;TRUE&quot;</span> <span class="kwrd">/&gt;</span>
              <span class="kwrd">&lt;</span><span class="html">HTML</span><span class="kwrd">&gt;&lt;!</span>[CDATA[&quot;]]<span class="kwrd">&gt;&lt;/</span><span class="html">HTML</span><span class="kwrd">&gt;</span>
              <span class="kwrd">&lt;</span><span class="html">Switch</span><span class="kwrd">&gt;</span>
                <span class="kwrd">&lt;</span><span class="html">Expr</span><span class="kwrd">&gt;</span>
                  <span class="kwrd">&lt;</span><span class="html">Property</span> <span class="attr">Select</span><span class="kwrd">=&quot;OpenLinkInNewWindow&quot;</span> <span class="kwrd">/&gt;</span>
                <span class="kwrd">&lt;/</span><span class="html">Expr</span><span class="kwrd">&gt;</span>
                <span class="kwrd">&lt;</span><span class="html">Case</span> <span class="attr">Value</span><span class="kwrd">=&quot;True&quot;</span><span class="kwrd">&gt;</span>
                  <span class="kwrd">&lt;</span><span class="html">HTML</span><span class="kwrd">&gt;&lt;!</span>[CDATA[ target=&quot;_blank&quot;]]<span class="kwrd">&gt;&lt;/</span><span class="html">HTML</span><span class="kwrd">&gt;</span>
                <span class="kwrd">&lt;/</span><span class="html">Case</span><span class="kwrd">&gt;</span>
              <span class="kwrd">&lt;/</span><span class="html">Switch</span><span class="kwrd">&gt;</span>
              <span class="kwrd">&lt;</span><span class="html">HTML</span><span class="kwrd">&gt;&lt;!</span>[CDATA[<span class="kwrd">&gt;</span>]]<span class="kwrd">&gt;&lt;/</span><span class="html">HTML</span><span class="kwrd">&gt;</span>
              <span class="kwrd">&lt;</span><span class="html">Column2</span> <span class="attr">HTMLEncode</span><span class="kwrd">=&quot;TRUE&quot;</span> <span class="kwrd">/&gt;</span>
              <span class="kwrd">&lt;</span><span class="html">HTML</span><span class="kwrd">&gt;&lt;!</span>[CDATA[<span class="kwrd">&lt;/</span><span class="html">a</span><span class="kwrd">&gt;</span>]]<span class="kwrd">&gt;&lt;/</span><span class="html">HTML</span><span class="kwrd">&gt;</span>
            <span class="kwrd">&lt;/</span><span class="html">Case</span><span class="kwrd">&gt;</span>
            <span class="kwrd">&lt;</span><span class="html">Default</span><span class="kwrd">&gt;</span>
              <span class="kwrd">&lt;</span><span class="html">HTML</span><span class="kwrd">&gt;&lt;!</span>[CDATA[<span class="kwrd">&lt;</span><span class="html">a</span> <span class="attr">href</span>=&quot;]]<span class="kwrd">&gt;&lt;/</span><span class="html">HTML</span><span class="kwrd">&gt;</span>
              <span class="kwrd">&lt;</span><span class="html">Column</span> <span class="attr">HTMLEncode</span><span class="kwrd">=&quot;TRUE&quot;</span> <span class="kwrd">/&gt;</span>
              <span class="kwrd">&lt;</span><span class="html">HTML</span><span class="kwrd">&gt;&lt;!</span>[CDATA[&quot;]]<span class="kwrd">&gt;&lt;/</span><span class="html">HTML</span><span class="kwrd">&gt;</span>
              <span class="kwrd">&lt;</span><span class="html">Switch</span><span class="kwrd">&gt;</span>
                <span class="kwrd">&lt;</span><span class="html">Expr</span><span class="kwrd">&gt;</span>
                  <span class="kwrd">&lt;</span><span class="html">Property</span> <span class="attr">Select</span><span class="kwrd">=&quot;OpenLinkInNewWindow&quot;</span> <span class="kwrd">/&gt;</span>
                <span class="kwrd">&lt;/</span><span class="html">Expr</span><span class="kwrd">&gt;</span>
                <span class="kwrd">&lt;</span><span class="html">Case</span> <span class="attr">Value</span><span class="kwrd">=&quot;True&quot;</span><span class="kwrd">&gt;</span>
                  <span class="kwrd">&lt;</span><span class="html">HTML</span><span class="kwrd">&gt;&lt;!</span>[CDATA[ target=&quot;_blank&quot;]]<span class="kwrd">&gt;&lt;/</span><span class="html">HTML</span><span class="kwrd">&gt;</span>
                <span class="kwrd">&lt;/</span><span class="html">Case</span><span class="kwrd">&gt;</span>
              <span class="kwrd">&lt;/</span><span class="html">Switch</span><span class="kwrd">&gt;</span>
              <span class="kwrd">&lt;</span><span class="html">HTML</span><span class="kwrd">&gt;&lt;!</span>[CDATA[<span class="kwrd">&gt;&lt;</span><span class="html">img</span> <span class="attr">border</span><span class="kwrd">=&quot;0&quot;</span> <span class="attr">src</span>=&quot;]]<span class="kwrd">&gt;&lt;/</span><span class="html">HTML</span><span class="kwrd">&gt;</span>
              <span class="kwrd">&lt;</span><span class="html">Property</span> <span class="attr">Select</span><span class="kwrd">=&quot;ItemImage&quot;</span> <span class="kwrd">/&gt;</span>
              <span class="kwrd">&lt;</span><span class="html">HTML</span><span class="kwrd">&gt;&lt;!</span>[CDATA[&quot; title=&quot;]]<span class="kwrd">&gt;&lt;/</span><span class="html">HTML</span><span class="kwrd">&gt;</span>
              <span class="kwrd">&lt;</span><span class="html">Column2</span> <span class="attr">HTMLEncode</span><span class="kwrd">=&quot;TRUE&quot;</span> <span class="kwrd">/&gt;</span>
              <span class="kwrd">&lt;</span><span class="html">HTML</span><span class="kwrd">&gt;&lt;!</span>[CDATA[&quot;<span class="kwrd">&gt;&lt;/</span><span class="html">a</span><span class="kwrd">&gt;</span>]]<span class="kwrd">&gt;&lt;/</span><span class="html">HTML</span><span class="kwrd">&gt;</span>
            <span class="kwrd">&lt;/</span><span class="html">Default</span><span class="kwrd">&gt;</span>
          <span class="kwrd">&lt;/</span><span class="html">Switch</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;/</span><span class="html">Default</span><span class="kwrd">&gt;</span>
      <span class="kwrd">&lt;/</span><span class="html">Switch</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;/</span><span class="html">Default</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;/</span><span class="html">Switch</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">RenderPattern</span><span class="kwrd">&gt;</span></pre>
<p>Finally we have to implement the fieldtypeclass by overriding the SPFieldUrl class. Define a private Boolean IsInitialized and set it false. The constructors are straight forward, as is the FieldRenderingControl. For the GetFieldValueAsHtml, you have to return the Url of the SPFieldUrlValue. In the OnAdded and OnUpdated method, check the IsInitialized Boolean and if not true, call the following method.</p>
<pre class="csharpcode"><span class="kwrd">Private</span> <span class="kwrd">Sub</span> ConfigureSchemaXml()
  IsInitialized = <span class="kwrd">Not</span> IsInitialized

  <span class="kwrd">Dim</span> HeaderImageValue <span class="kwrd">As</span> <span class="kwrd">String</span> = _
<span class="kwrd">    MyBase</span>.GetCustomProperty(<span class="str">&quot;HeaderImage&quot;</span>)
  <span class="kwrd">Dim</span> ItemImageValue <span class="kwrd">As</span> <span class="kwrd">String</span> = _
<span class="kwrd">    MyBase</span>.GetCustomProperty(<span class="str">&quot;ItemImage&quot;</span>)
  <span class="kwrd">Dim</span> ShowDescriptionValue <span class="kwrd">As</span> <span class="kwrd">Boolean</span> = _
    <span class="kwrd">MyBase</span>.GetCustomProperty(<span class="str">&quot;ShowDescription&quot;</span>)
  <span class="kwrd">Dim</span> OpenLinkInNewWindowValue <span class="kwrd">As</span> <span class="kwrd">Boolean</span> = _
    <span class="kwrd">MyBase</span>.GetCustomProperty(<span class="str">&quot;OpenLinkInNewWindow&quot;</span>)
  <span class="kwrd">Dim</span> doc <span class="kwrd">As</span> XmlDocument = <span class="kwrd">New</span> XmlDocument()

  doc.LoadXml(<span class="kwrd">MyBase</span>.SchemaXml)

  <span class="kwrd">If</span> (doc.FirstChild.Attributes(<span class="str">&quot;HeaderImage&quot;</span>) <span class="kwrd">Is</span> <span class="kwrd">Nothing</span>) <span class="kwrd">Then</span>
    <span class="kwrd">Dim</span> xmlAttrib <span class="kwrd">As</span> XmlAttribute = doc.CreateAttribute(<span class="str">&quot;HeaderImage&quot;</span>)
    xmlAttrib.Value = HeaderImageValue
    doc.FirstChild.Attributes.Append(xmlAttrib)
  <span class="kwrd">Else</span>
    doc.FirstChild.Attributes(<span class="str">&quot;HeaderImage&quot;</span>).Value = HeaderImageValue
  <span class="kwrd">End</span> <span class="kwrd">If</span>
  <span class="kwrd">If</span> (doc.FirstChild.Attributes(<span class="str">&quot;ItemImage&quot;</span>) <span class="kwrd">Is</span> <span class="kwrd">Nothing</span>) <span class="kwrd">Then</span>
    <span class="kwrd">Dim</span> xmlAttrib <span class="kwrd">As</span> XmlAttribute = doc.CreateAttribute(<span class="str">&quot;ItemImage&quot;</span>)
    xmlAttrib.Value = ItemImageValue
    doc.FirstChild.Attributes.Append(xmlAttrib)
  <span class="kwrd">Else</span>
    doc.FirstChild.Attributes(<span class="str">&quot;ItemImage&quot;</span>).Value = ItemImageValue
  <span class="kwrd">End</span> <span class="kwrd">If</span>
  <span class="kwrd">If</span> (doc.FirstChild.Attributes(<span class="str">&quot;ShowDescription&quot;</span>) <span class="kwrd">Is</span> <span class="kwrd">Nothing</span>) <span class="kwrd">Then</span>
    <span class="kwrd">Dim</span> xmlAttrib <span class="kwrd">As</span> XmlAttribute = doc.CreateAttribute(<span class="str">&quot;ShowDescription&quot;</span>)
    xmlAttrib.Value = ShowDescriptionValue
    doc.FirstChild.Attributes.Append(xmlAttrib)
  <span class="kwrd">Else</span>
    doc.FirstChild.Attributes(<span class="str">&quot;ShowDescription&quot;</span>).Value = _
        ShowDescriptionValue
  <span class="kwrd">End</span> <span class="kwrd">If</span>
  <span class="kwrd">If</span> (doc.FirstChild.Attributes(<span class="str">&quot;OpenLinkInNewWindow&quot;</span>) <span class="kwrd">Is</span> <span class="kwrd">Nothing</span>) <span class="kwrd">Then</span>
    <span class="kwrd">Dim</span> xmlAttrib <span class="kwrd">As</span> XmlAttribute = _
    doc.CreateAttribute(<span class="str">&quot;OpenLinkInNewWindow&quot;</span>)
    xmlAttrib.Value = OpenLinkInNewWindowValue
    doc.FirstChild.Attributes.Append(xmlAttrib)
  <span class="kwrd">Else</span>
    doc.FirstChild.Attributes(<span class="str">&quot;OpenLinkInNewWindow&quot;</span>).Value = _
        OpenLinkInNewWindowValue
  <span class="kwrd">End</span> <span class="kwrd">If</span>

  <span class="kwrd">MyBase</span>.SchemaXml = doc.OuterXml
<span class="kwrd">End</span> <span class="kwrd">Sub</span></pre>
<p>If everything went well, you should see a new fieldtype, but it cannot be used from the userinterface. You will still get some errors. However if you use it from code, it will work already. In Part 2, I will discuss how to alter this one to use it as a real fieldtype via the userinterface.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/spbartnet.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/spbartnet.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/spbartnet.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/spbartnet.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/spbartnet.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/spbartnet.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/spbartnet.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/spbartnet.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/spbartnet.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/spbartnet.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/spbartnet.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/spbartnet.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/spbartnet.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/spbartnet.wordpress.com/127/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=spbartnet.wordpress.com&amp;blog=5121270&amp;post=127&amp;subd=spbartnet&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://spbartnet.wordpress.com/2010/01/13/mimicking-the-workspace-column-of-an-event-item-part-1-3/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/de06ff097f1c55d2a479790c5508d197?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bartsnyckers</media:title>
		</media:content>
	</item>
		<item>
		<title>Group cannot be found</title>
		<link>http://spbartnet.wordpress.com/2009/12/18/group-cannot-be-found/</link>
		<comments>http://spbartnet.wordpress.com/2009/12/18/group-cannot-be-found/#comments</comments>
		<pubDate>Fri, 18 Dec 2009 10:42:59 +0000</pubDate>
		<dc:creator>Bart Snyckers</dc:creator>
				<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[Site Collection]]></category>
		<category><![CDATA[Site Groups]]></category>
		<category><![CDATA[SPUser]]></category>

		<guid isPermaLink="false">http://spbartnet.wordpress.com/?p=117</guid>
		<description><![CDATA[I think every developer experiences a moment in his career that he is pretty sure his code is correct, but it isn&#8217;t. There is a problem without any doubt, but although he looks a thousand times at his code, he can&#8217;t find it. Eventually he starts to doubt himself and after a lot of sweat, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=spbartnet.wordpress.com&amp;blog=5121270&amp;post=117&amp;subd=spbartnet&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I think every developer experiences a moment in his career that he is pretty sure his code is correct, but it isn&#8217;t. There is a problem without any doubt, but although he looks a thousand times at his code, he can&#8217;t find it. Eventually he starts to doubt himself and after a lot of sweat, coffees, no-sleep, grrrrs, help-me-please, he suddenly yells very loud. Everyone is looking and wondering which pills he forgot to take this morning and the only thing you have is a very big smile on your face and red cheeks. And yes, you can guess it probably, I experienced that this week!</p>
<p>The case (ripped to the bottom) was very simple. I had to create a new Site Collection, add a group to this new Site Collection and update some properties of this new group. Simple isn&#8217;t it? Let me paste the code I wrote for this and probably everyone sees the problem immediately. Only thing I have as input was an url to a Site Collection, an url, a title and an owner for the new Site Collection and a name for the new Group.</p>
<p><span style="color:#3366ff;"><span style="color:#0000ff;">Dim</span> </span>site <span style="color:#0000ff;">As </span>SPSite = <span style="color:#0000ff;">New </span>SPSite(siteUrl)<br />
<span style="color:#0000ff;"> Dim </span>webApp <span style="color:#0000ff;">As </span>SPWebApplication = site.WebApplication</p>
<p><span style="color:#0000ff;">Dim </span>newSite <span style="color:#0000ff;">As </span>SPSite = webApp.Sites.Add(newSiteUrl, newSiteTitle, <span style="color:#0000ff;">Nothing</span>, 1033, newSiteOwner, <span style="color:#0000ff;">Nothing</span>, <span style="color:#0000ff;">Nothing</span>)<br />
<span style="color:#0000ff;"> Dim </span>newWeb <span style="color:#0000ff;">As </span>SPWeb = newSite.RootWeb()</p>
<p>newWeb.SiteGroups.Add(newGroupName, site.Owner, <span style="color:#0000ff;">Nothing</span>, <span style="color:#0000ff;">Nothing</span>)<br />
<span style="color:#0000ff;"> Dim </span>newGroup <span style="color:#0000ff;">As </span>SPGroup = newWeb.SiteGroups(newGroupName)</p>
<p>You see it? Let&#8217;s hope you don&#8217;t, otherwise I feel really stupid <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  On the last line, you get a nice exception, Group cannot be found. Unless, and here is the fun part, your site.Owner is the same account as who is running your Web Application (in other words the account running the Application Pool for your Web Site in IIS).</p>
<p>So you have a workaround and a real problem to tackle. If you know what, it is simple. Don&#8217;t use SPUser objects from other Site Collections to do things! You see the problem now? For those who don&#8217;t, replace site.Owner (an SPUser object from another Site Collection) with newSite.Owner and everything is solved. Stupid I looked over this and didn&#8217;t realised this could be a potential problem, but lesson learned as they say.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/spbartnet.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/spbartnet.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/spbartnet.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/spbartnet.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/spbartnet.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/spbartnet.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/spbartnet.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/spbartnet.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/spbartnet.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/spbartnet.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/spbartnet.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/spbartnet.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/spbartnet.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/spbartnet.wordpress.com/117/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=spbartnet.wordpress.com&amp;blog=5121270&amp;post=117&amp;subd=spbartnet&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://spbartnet.wordpress.com/2009/12/18/group-cannot-be-found/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/de06ff097f1c55d2a479790c5508d197?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bartsnyckers</media:title>
		</media:content>
	</item>
		<item>
		<title>Check if current user is member of People or Group listitem field</title>
		<link>http://spbartnet.wordpress.com/2009/12/07/check-if-current-user-is-member-of-people-or-group-listitem-field/</link>
		<comments>http://spbartnet.wordpress.com/2009/12/07/check-if-current-user-is-member-of-people-or-group-listitem-field/#comments</comments>
		<pubDate>Mon, 07 Dec 2009 10:00:52 +0000</pubDate>
		<dc:creator>Bart Snyckers</dc:creator>
				<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[Delegate]]></category>
		<category><![CDATA[People or Group]]></category>
		<category><![CDATA[Permissions]]></category>
		<category><![CDATA[SPFieldUserValueCollection]]></category>
		<category><![CDATA[SPListItem]]></category>

		<guid isPermaLink="false">http://spbartnet.wordpress.com/?p=114</guid>
		<description><![CDATA[Recently we build some custom display and edit forms for a list, but need to secure the view and edit rights for the listitems. We didn&#8217;t wanted to use listitem permissions, because the list contained People or Group columns, where we could derive the permissions from. It wouldn&#8217;t be user friendly if they had to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=spbartnet.wordpress.com&amp;blog=5121270&amp;post=114&amp;subd=spbartnet&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Recently we build some custom display and edit forms for a list, but need to secure the view and edit rights for the listitems. We didn&#8217;t wanted to use listitem permissions, because the list contained People or Group columns, where we could derive the permissions from. It wouldn&#8217;t be user friendly if they had to define the People or Group fields and set listitem permissions. Sooner or later, this would run out of sync and end users would be confused.</p>
<p>So, after some research on the internet and the MSDN library, I found out that a <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfielduservaluecollection.aspx">SPFieldUserValueCollection</a> contains an <a href="http://msdn.microsoft.com/en-us/library/bfed8bca.aspx">Exists</a> method, to which you have to pass a delegate to a method. This delegate method will accept a Predicate(Of T) on a List(T). So in our case the delegate method had to accept a SPFieldUserValue. In return it will give a boolean value defining if the user is contained in the People or Group field.</p>
<p>A People or Group field can contain SharePoint Groups, Domain Users, Domain Groups and/or Distribution Groups. Below you can find an implementation for the first three types of values. The method can be used for a single value and multiple value People or Group Field. As soon as it returns true, it will skip checking other values in the multiple value form. You can replace the web object with SPContext.Current.Web offcourse and keep in mind that you have to implement the DomainGroupContainsCurrentUser method. Implementations of this using LDAP can be found at the internet.</p>
<p><span style="color:#0000ff;">Private Function</span> CurrentUser(<span style="color:#0000ff;">ByVal </span>fuv <span style="color:#0000ff;">As </span>SPFieldUserValue) <span style="color:#0000ff;">As Boolean</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;"> If</span> fuv.User <span style="color:#0000ff;">IsNot Nothing AndAlso Not</span> fuv.User.IsDomainGroup <span style="color:#0000ff;">Then</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;"> Return</span> (fuv.User.ID = web.CurrentUser.ID)<br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;"> ElseIf</span> fuv.User <span style="color:#0000ff;">IsNot Nothing AndAlso</span> fuv.User.IsDomainGroup <span style="color:#0000ff;">Then</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;"> Return</span> DomainGroupContainsCurrentUser(fuv.User.Name)<br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;"> ElseIf</span> web.SiteGroups.GetByID(fuv.LookupId).ContainsCurrentUser() <span style="color:#0000ff;">Then</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;"> Return True</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;"> Else</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;"> Return False</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;"> End If</span><br />
<span style="color:#0000ff;"> End Function</span></p>
<p>Calling this method is pretty simple. Suppose you have a SPFieldUserValueCollection, <em>fuvc</em>, then you just enter <em>fuvc.Exists(AddressOf CurrentUser)</em> in VB.NET. This approach can be used for every SP&#8230;Collection because they all derive from List(T).</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/spbartnet.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/spbartnet.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/spbartnet.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/spbartnet.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/spbartnet.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/spbartnet.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/spbartnet.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/spbartnet.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/spbartnet.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/spbartnet.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/spbartnet.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/spbartnet.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/spbartnet.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/spbartnet.wordpress.com/114/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=spbartnet.wordpress.com&amp;blog=5121270&amp;post=114&amp;subd=spbartnet&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://spbartnet.wordpress.com/2009/12/07/check-if-current-user-is-member-of-people-or-group-listitem-field/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/de06ff097f1c55d2a479790c5508d197?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bartsnyckers</media:title>
		</media:content>
	</item>
	</channel>
</rss>
