<?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>Jalil Sear&#039;s [MCPD SharePoint 2010] Weblog</title>
	<atom:link href="http://jasear.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://jasear.wordpress.com</link>
	<description>Sharing ideas on SharePoint, .NET and general development</description>
	<lastBuildDate>Sat, 28 Jan 2012 06:15:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='jasear.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Jalil Sear&#039;s [MCPD SharePoint 2010] Weblog</title>
		<link>http://jasear.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://jasear.wordpress.com/osd.xml" title="Jalil Sear&#039;s [MCPD SharePoint 2010] Weblog" />
	<atom:link rel='hub' href='http://jasear.wordpress.com/?pushpress=hub'/>
		<item>
		<title>ASP.NET LinkedListBoxes UserControl</title>
		<link>http://jasear.wordpress.com/2012/01/05/asp-net-linkedlistboxes-usercontrol/</link>
		<comments>http://jasear.wordpress.com/2012/01/05/asp-net-linkedlistboxes-usercontrol/#comments</comments>
		<pubDate>Thu, 05 Jan 2012 02:02:26 +0000</pubDate>
		<dc:creator>jasear</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[2010]]></category>
		<category><![CDATA[ASP.net]]></category>
		<category><![CDATA[c#. .net]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[Linked ListBoxes]]></category>
		<category><![CDATA[ListBox]]></category>
		<category><![CDATA[MOSS 2007]]></category>
		<category><![CDATA[sharepoint]]></category>
		<category><![CDATA[Sharepoint 2010]]></category>
		<category><![CDATA[SharePoint 2010; MOSS 2007; C#; ASP.NET]]></category>

		<guid isPermaLink="false">http://jasear.wordpress.com/?p=265</guid>
		<description><![CDATA[I needed a simple Linked ListBox control for a project but couldnt find one that was available for free so I ended up developing one myself. I have created a project for it on codeplex and published it. Please feel free to use/modify the control as you require. If you have any suggestions or feedback [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jasear.wordpress.com&amp;blog=4155040&amp;post=265&amp;subd=jasear&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I needed a simple Linked ListBox control for a project but couldnt find one that was available for free so I ended up developing one myself.</p>
<p>I have created a project for it on codeplex and published it. Please feel free to use/modify the control as you require. If you have any suggestions or feedback then please feel free to leave a comment.</p>
<p>The control uses two ListBoxes with two buttons (add, remove) in between that allows you to add and remove items by using some Javascript. The screen shot below shows the control in action:</p>
<p><img src="http://jasear.files.wordpress.com/2012/01/linkedlistoxes.png?w=600" alt="LinkedListBox UserControl" /></p>
<p>You can download the complete source code from the link below:</p>
<p><a href="http://linkedlistboxes.codeplex.com/SourceControl/changeset/changes/66998" title="LinkedListBox UserControl sourcecode." target="_blank">LinkedListBox UserControl sourcecode.</a></p>
<p>You can also download a sample Visual Studio 2010 project that shows the control in action by going to the project home page and clicking on the Download button:</p>
<p><a href="http://linkedlistboxes.codeplex.com/" title="Project homepage" target="_blank">Project homepage</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jasear.wordpress.com/265/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jasear.wordpress.com/265/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jasear.wordpress.com/265/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jasear.wordpress.com/265/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jasear.wordpress.com/265/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jasear.wordpress.com/265/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jasear.wordpress.com/265/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jasear.wordpress.com/265/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jasear.wordpress.com/265/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jasear.wordpress.com/265/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jasear.wordpress.com/265/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jasear.wordpress.com/265/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jasear.wordpress.com/265/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jasear.wordpress.com/265/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jasear.wordpress.com&amp;blog=4155040&amp;post=265&amp;subd=jasear&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jasear.wordpress.com/2012/01/05/asp-net-linkedlistboxes-usercontrol/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c1b64111045e82b6dda5c652ed445c9f?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">jasear</media:title>
		</media:content>

		<media:content url="http://jasear.files.wordpress.com/2012/01/linkedlistoxes.png" medium="image">
			<media:title type="html">LinkedListBox UserControl</media:title>
		</media:content>
	</item>
		<item>
		<title>SharePoint 2010: List Fields not showing up in Edit, Display or New Forms</title>
		<link>http://jasear.wordpress.com/2011/12/28/sharepoint-2010-list-fields-not-showing-up-in-edit-display-or-new-forms/</link>
		<comments>http://jasear.wordpress.com/2011/12/28/sharepoint-2010-list-fields-not-showing-up-in-edit-display-or-new-forms/#comments</comments>
		<pubDate>Wed, 28 Dec 2011 19:11:06 +0000</pubDate>
		<dc:creator>jasear</dc:creator>
				<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[ASP.net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[caml]]></category>
		<category><![CDATA[fields]]></category>
		<category><![CDATA[list definition]]></category>
		<category><![CDATA[sharepoint]]></category>
		<category><![CDATA[Sharepoint 2010]]></category>
		<category><![CDATA[splist]]></category>

		<guid isPermaLink="false">http://jasear.wordpress.com/?p=256</guid>
		<description><![CDATA[I have seen a lot of people get stuck on this issue. Look at the CAML markup in the list definition&#8217;s Schema.xml file below (this was auto-generated by the Visual Studio SharePoint &#8216;List Definition&#8217; template selecting Custom List as the list type): Looking at the list definition you would assume that the edit, display and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jasear.wordpress.com&amp;blog=4155040&amp;post=256&amp;subd=jasear&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I have seen a lot of people get stuck on this issue.</p>
<p>Look at the CAML markup in the list definition&#8217;s Schema.xml file below (this was auto-generated by the Visual Studio SharePoint &#8216;List Definition&#8217; template selecting Custom List as the list type):</p>
<p><pre class="brush: xml;">
&lt;List xmlns:ows=&quot;Microsoft SharePoint&quot; Title=&quot;Custom List&quot; FolderCreation=&quot;FALSE&quot; Direction=&quot;$Resources:Direction;&quot; Url=&quot;Lists/ACustomList&quot; BaseType=&quot;0&quot; xmlns=&quot;http://schemas.microsoft.com/sharepoint/&quot;&gt;
  &lt;MetaData&gt;
    &lt;ContentTypes&gt;
      &lt;ContentTypeRef ID=&quot;0x01&quot;&gt;
        &lt;Folder TargetName=&quot;Item&quot; /&gt;
      &lt;/ContentTypeRef&gt;
    &lt;/ContentTypes&gt;
    &lt;Fields&gt;
      &lt;Field ID=&quot;{fa564e0f-0c70-4ab9-b863-0177e6ddd247}&quot; Type=&quot;Text&quot; Name=&quot;Title&quot; DisplayName=&quot;Title&quot; Required=&quot;TRUE&quot; StaticName=&quot;Title&quot; FromBaseType=&quot;TRUE&quot; /&gt;
      &lt;Field ID=&quot;{AACF7B24-80FC-4EB6-8C73-381626D056C6}&quot; Name=&quot;Value&quot; StaticName=&quot;Value&quot; Type=&quot;Note&quot; DisplayName=&quot;Value&quot; NumLines=&quot;6&quot; RichText=&quot;TRUE&quot; /&gt;
    &lt;/Fields&gt;
......
.............
</pre></p>
<p>Looking at the list definition you would assume that the edit, display and new forms would display two fields (Title and Value) but in actual fact it only displays the Title field.</p>
<p>The reason for this is that in the markup we have specified that the list uses the Item (0&#215;01) content type but the additional field is not part of that content type hence it does not appear in the forms.</p>
<p>To ensure they appear we either need to:</p>
<ul>
<li> Remove the content type reference from the markup</li>
<li> Or we could create a new content type that inherits from the Item content type and include this additional field as part of its definition. We can then reference that content type in our list definition instead of the Item content type.</li>
</ul>
<p>Other reasons that might cause your fields to not appear in edit, new and/or display forms of your list could be:</p>
<ul>
<li>Field&#8217;s ShowInEditForm, ShowInDisplayForm, ShowInNewForm attributes are set to FALSE</li>
<li>Field is Hidden</li>
<li>Field is set as ReadOnly</li>
<ul>
<p></p>
<p>Please not that this is not an exhaustive list. Hope this helps someone.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jasear.wordpress.com/256/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jasear.wordpress.com/256/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jasear.wordpress.com/256/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jasear.wordpress.com/256/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jasear.wordpress.com/256/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jasear.wordpress.com/256/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jasear.wordpress.com/256/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jasear.wordpress.com/256/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jasear.wordpress.com/256/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jasear.wordpress.com/256/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jasear.wordpress.com/256/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jasear.wordpress.com/256/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jasear.wordpress.com/256/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jasear.wordpress.com/256/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jasear.wordpress.com&amp;blog=4155040&amp;post=256&amp;subd=jasear&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jasear.wordpress.com/2011/12/28/sharepoint-2010-list-fields-not-showing-up-in-edit-display-or-new-forms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c1b64111045e82b6dda5c652ed445c9f?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">jasear</media:title>
		</media:content>
	</item>
		<item>
		<title>SharePoint 2010 Login issue only using IE (Internet Explorer) on an FBA enabled Site</title>
		<link>http://jasear.wordpress.com/2011/12/27/sharepoint-2010-login-issue-only-using-ie-internet-explorer-on-an-fba-enabled-site/</link>
		<comments>http://jasear.wordpress.com/2011/12/27/sharepoint-2010-login-issue-only-using-ie-internet-explorer-on-an-fba-enabled-site/#comments</comments>
		<pubDate>Tue, 27 Dec 2011 01:39:26 +0000</pubDate>
		<dc:creator>jasear</dc:creator>
				<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[browser settings]]></category>
		<category><![CDATA[fba]]></category>
		<category><![CDATA[login]]></category>
		<category><![CDATA[microsoft sharepoint]]></category>
		<category><![CDATA[persistent cookie]]></category>
		<category><![CDATA[SharePoint 2010; MOSS 2007; C#; ASP.NET]]></category>

		<guid isPermaLink="false">http://jasear.wordpress.com/?p=245</guid>
		<description><![CDATA[Recently I bought a new laptop (OS: Windows 7 Professional). Using IE9 I opened up one of our SharePoint 2010 sites and tried to login and it just refreshed the login page with no error messages displayed. Using IE9 on my old laptop had never caused this issue. I searched a lot on the interwebs [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jasear.wordpress.com&amp;blog=4155040&amp;post=245&amp;subd=jasear&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Recently I bought a new laptop (OS: Windows 7 Professional). Using IE9 I opened up one of our SharePoint 2010 sites and tried to login and it just refreshed the login page with no error messages displayed. Using IE9 on my old laptop had never caused this issue.</p>
<p>I searched a lot on the interwebs to see if other people had encountered this issue and I found a lot of people in a similar situation but all the suggestions I found to solve this issue a) did not work for me, b) were unacceptable in any case. They included suggestions like adding the site as a trusted site and then making x,y and z changes to your browser settings.</p>
<p>One of our SharePoint 2010 site is a public facing site where people register and can gain access to the site. Imagine telling those 1000&#8242;s of users you need to make x,y,z changes to your browser settings in order to gain access to our site. </p>
<p>What I noticed was that I was having this issue when I clicked on the &#8220;remember me&#8221; checkbox on the login page (selecting this option issues a persistent cookie). If I did not check this option then I was able to login without any problems.</p>
<p>To cut a long story short, by a complete freak accident, I was able to fix this issue by making a small change in the web.config of the Web Application. If your site uses Claims Based Authentication you will see the following section in your web.config file:<br />
<pre class="brush: xml;">
 &lt;microsoft.identityModel&gt;
    &lt;service saveBootstrapTokens=&quot;true&quot;&gt;
      &lt;audienceUris /&gt;
      &lt;issuerNameRegistry type=&quot;Microsoft.SharePoint.IdentityModel.SPPassiveIssuerNameRegistry, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c&quot; /&gt;
      &lt;securityTokenHandlers&gt;
        &lt;clear /&gt;
        &lt;add type=&quot;Microsoft.IdentityModel.Tokens.X509SecurityTokenHandler, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35&quot; /&gt;
        &lt;add type=&quot;Microsoft.SharePoint.IdentityModel.SPSaml11SecurityTokenHandler, Microsoft.SharePoint.IdentityModel, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c&quot;&gt;
          &lt;samlSecurityTokenRequirement&gt;
            &lt;nameClaimType value=&quot;http://schemas.microsoft.com/sharepoint/2009/08/claims/userid&quot; /&gt;
          &lt;/samlSecurityTokenRequirement&gt;
        &lt;/add&gt;
        &lt;add type=&quot;Microsoft.SharePoint.IdentityModel.SPTokenCache, Microsoft.SharePoint.IdentityModel, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c&quot; /&gt;
      &lt;/securityTokenHandlers&gt;
      &lt;federatedAuthentication&gt;
        &lt;wsFederation passiveRedirectEnabled=&quot;false&quot; issuer=&quot;https://none&quot; realm=&quot;https://none&quot; /&gt;
        &lt;cookieHandler mode=&quot;Custom&quot; path=&quot;/&quot; &gt;
          &lt;customCookieHandler type=&quot;Microsoft.SharePoint.IdentityModel.SPChunkedCookieHandler, Microsoft.SharePoint.IdentityModel, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c&quot; /&gt;
        &lt;/cookieHandler&gt;
      &lt;/federatedAuthentication&gt;
    &lt;/service&gt;
  &lt;/microsoft.identityModel&gt;
</pre></p>
<p>I made the following change (<strong>persistentSessionLifetime=&#8221;60&#8243;</strong>):</p>
<p><pre class="brush: xml;">
&lt;cookieHandler mode=&quot;Custom&quot; path=&quot;/&quot; persistentSessionLifetime=&quot;60&quot;&gt;
</pre></p>
<p>I am not sure why but this fixed the issue for me.</p>
<p>Hope this helps someone else.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jasear.wordpress.com/245/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jasear.wordpress.com/245/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jasear.wordpress.com/245/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jasear.wordpress.com/245/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jasear.wordpress.com/245/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jasear.wordpress.com/245/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jasear.wordpress.com/245/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jasear.wordpress.com/245/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jasear.wordpress.com/245/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jasear.wordpress.com/245/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jasear.wordpress.com/245/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jasear.wordpress.com/245/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jasear.wordpress.com/245/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jasear.wordpress.com/245/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jasear.wordpress.com&amp;blog=4155040&amp;post=245&amp;subd=jasear&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jasear.wordpress.com/2011/12/27/sharepoint-2010-login-issue-only-using-ie-internet-explorer-on-an-fba-enabled-site/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c1b64111045e82b6dda5c652ed445c9f?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">jasear</media:title>
		</media:content>
	</item>
		<item>
		<title>SharePoint 2010: List column that renders as a dynamic hyperlink</title>
		<link>http://jasear.wordpress.com/2011/04/18/sharepoint-2010-list-column-that-renders-as-a-dynamic-hyperlink/</link>
		<comments>http://jasear.wordpress.com/2011/04/18/sharepoint-2010-list-column-that-renders-as-a-dynamic-hyperlink/#comments</comments>
		<pubDate>Mon, 18 Apr 2011 23:28:39 +0000</pubDate>
		<dc:creator>jasear</dc:creator>
				<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[SharePoint 2010; MOSS 2007; C#; ASP.NET]]></category>

		<guid isPermaLink="false">http://jasear.wordpress.com/?p=225</guid>
		<description><![CDATA[A while back I worked on a project where we needed to add a column to a SharePoint List that would display a link based on values in other columns. For example: &#8220;/myWeb/pages/mycustomPage.aspx?Reference=[ValueToComeFromAnotherColumn] i.e. similar to the way the Title field link is rendered where the URL is dynamic and based on the ID of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jasear.wordpress.com&amp;blog=4155040&amp;post=225&amp;subd=jasear&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>A while back I worked on a project where we needed to add a column to a SharePoint List that would display a link based on values in other columns. For example: &#8220;/myWeb/pages/mycustomPage.aspx?Reference=[ValueToComeFromAnotherColumn] i.e. similar to the way the Title field link is rendered where the URL is dynamic and based on the ID of the row in question.</p>
<p>In MOSS 2007 we did this by adding a calculated column that constructed the HTML using our specified formula. However, the problem was that the link would appear as:</p>
<p><pre class="brush: xml;">
 &lt;a href=&quot;myWeb/pages/mycustomPage.aspx?Reference=45&quot;&gt;View&lt;/a&gt;
</pre></p>
<p>To ensure it rendered as a nice and friendly hyperlink we used a script created by Christophe from PathToSharePoint.com (his blogs on the subject dont seem to exist anymore). It worked pretty well in MOSS 2007 but we found that in MOSS 2010 it didnt work if your list view had grouping by any column.</p>
<p>Initially I tried to get the script to work but then realised that there was a much better way to do this in SharePoint 2010. In 2010 you can control how any field is rendered by creating a custom XSLT stylesheet. In our scenario we created an XSL file which was deployed at &#8220;C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\XSL&#8221;. The XSL file must be named in the following format fldtypes_*.xsl, where * is any valid filename string value for example fldtypes_MyCustomDefinitions.xsl. Our XSL file looked something like this:</p>
<p><pre class="brush: xml;">
&lt;xsl:stylesheet xmlns:x=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns:d=&quot;http://schemas.microsoft.com/sharepoint/dsp&quot; version=&quot;1.0&quot; exclude-result-prefixes=&quot;xsl msxsl ddwrt&quot; xmlns:ddwrt=&quot;http://schemas.microsoft.com/WebParts/v2/DataView/runtime&quot; xmlns:asp=&quot;http://schemas.microsoft.com/ASPNET/20&quot; xmlns:__designer=&quot;http://schemas.microsoft.com/WebParts/v2/DataView/designer&quot; xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot; xmlns:msxsl=&quot;urn:schemas-microsoft-com:xslt&quot; xmlns:SharePoint=&quot;Microsoft.SharePoint.WebControls&quot; xmlns:ddwrt2=&quot;urn:frontpage:internal&quot;&gt;
  &lt;xsl:template match=&quot;FieldRef[@Name='FormLink']&quot; mode=&quot;Computed_body&quot;&gt;
    &lt;xsl:param name=&quot;thisNode&quot; select=&quot;.&quot;/&gt;
	    &lt;a target=&quot;_blank&quot; href=&quot;/appeal/pages/appealapplication.aspx?ApplicationRef={$thisNode/@ApplicationRef}&quot;&gt;View Application&lt;/a&gt;
  &lt;/xsl:template&gt;
 &lt;/xsl:stylesheet&gt;</pre></p>
<p>The important bit is the match attribute in the xsl:template element where we specify the internal name of the Field we want this custom rendering applied to. What this basically does is that where ever a field with an internal name of FormLink is being rendered in a view it will render it as a hyperlink. Below is the definition for our SharePoint List Field:</p>
<p><pre class="brush: xml;">
&lt;Field ReadOnly=&quot;TRUE&quot; ID=&quot;{2DD3638A-56A0-4021-B2B9-7BBB19E191F1}&quot; Name=&quot;FormLink&quot; StaticName=&quot;FormLink&quot; DisplayName=&quot;Application&quot; Type=&quot;Computed&quot; Group=&quot;My Custom Group&quot; SourceID=&quot;http://schemas.microsoft.com/sharepoint/v3&quot; /&gt;
</pre></p>
<p>That is all there is to it, now when ever and where ever our field is rendered in a view it renders it in our custom way.</p>
<p><strong>Update: For this to work, the column you are referencing must exist in the view. In my example above I am referencing a column called &#8220;ApplicationRef&#8221; therefore for it to work in my scenario the SharePoint List View I want it to work in must have &#8220;ApplicationRef&#8221; column otherwise the value wont be picked up. Hope this makes sense.</strong></p>
<p><strong><font color="red">I have created a sample Visual Studio SharePoint Project that demonstrates this functionality. Please click on the link below to download it. Just deploy the solution from Visual Studio and it will create a list with a dynamic hyperlink column.</font></strong></p>
<p><strong><a href="http://www.mediafire.com/?cusjrksq9dk9kmv" title="Dynamic Link VS Example" target="_blank"><img src="http://telnic.org/images/icon_zip.gif" alt="zip" align="bottom" />&nbsp;DynamicHyperLink.zip</a></strong></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jasear.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jasear.wordpress.com/225/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jasear.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jasear.wordpress.com/225/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jasear.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jasear.wordpress.com/225/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jasear.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jasear.wordpress.com/225/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jasear.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jasear.wordpress.com/225/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jasear.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jasear.wordpress.com/225/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jasear.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jasear.wordpress.com/225/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jasear.wordpress.com&amp;blog=4155040&amp;post=225&amp;subd=jasear&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jasear.wordpress.com/2011/04/18/sharepoint-2010-list-column-that-renders-as-a-dynamic-hyperlink/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c1b64111045e82b6dda5c652ed445c9f?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">jasear</media:title>
		</media:content>

		<media:content url="http://telnic.org/images/icon_zip.gif" medium="image">
			<media:title type="html">zip</media:title>
		</media:content>
	</item>
		<item>
		<title>0&#215;80070057 Invalid data has been used to update the list item. The field you are trying to update may be read only.</title>
		<link>http://jasear.wordpress.com/2011/03/22/0x80070057-invalid-data-has-been-used-to-update-the-list-item-the-field-you-are-trying-to-update-may-be-read-only/</link>
		<comments>http://jasear.wordpress.com/2011/03/22/0x80070057-invalid-data-has-been-used-to-update-the-list-item-the-field-you-are-trying-to-update-may-be-read-only/#comments</comments>
		<pubDate>Tue, 22 Mar 2011 14:11:09 +0000</pubDate>
		<dc:creator>jasear</dc:creator>
				<category><![CDATA[MOSS 2007]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[ASP.net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[lookup]]></category>
		<category><![CDATA[sharepoint]]></category>
		<category><![CDATA[sp2010]]></category>
		<category><![CDATA[splist]]></category>

		<guid isPermaLink="false">http://jasear.wordpress.com/?p=216</guid>
		<description><![CDATA[I came across this strange error today when I was trying to (programmatically) update a lookup column in a SharePoint list. Below is the declaration for the lookup column in the schema.xml of the list: When I removed FieldRef=&#8221;ID&#8221; and then re-created the list it solved the problem. I am not really sure why or [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jasear.wordpress.com&amp;blog=4155040&amp;post=216&amp;subd=jasear&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I came across this strange error today when I was trying to (programmatically) update a lookup column in a SharePoint list.</p>
<p>Below is the declaration for the lookup column in the schema.xml of the list:</p>
<p><pre class="brush: csharp;">
&lt;Field ID=&quot;{25b21cbb-c154-4dda-ac58-506a5853e5de}&quot; Name=&quot;mlClientID&quot; 
StaticName=&quot;mlClientID&quot; Type=&quot;Lookup&quot; DisplayName=&quot;Company&quot; List=&quot;Lists/mcompany&quot; FieldRef=&quot;ID&quot; ShowField=&quot;Title&quot; Group=&quot;Custom Columns&quot; /&gt;
</pre></p>
<p>When I removed <strong>FieldRef=&#8221;ID&#8221;</strong> and then re-created the list it solved the problem.</p>
<p>I am not really sure why or what is going on in the background that causes this issue but I hope this helps someone incase you have the same problem.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jasear.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jasear.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jasear.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jasear.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jasear.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jasear.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jasear.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jasear.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jasear.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jasear.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jasear.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jasear.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jasear.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jasear.wordpress.com/216/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jasear.wordpress.com&amp;blog=4155040&amp;post=216&amp;subd=jasear&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jasear.wordpress.com/2011/03/22/0x80070057-invalid-data-has-been-used-to-update-the-list-item-the-field-you-are-trying-to-update-may-be-read-only/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c1b64111045e82b6dda5c652ed445c9f?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">jasear</media:title>
		</media:content>
	</item>
		<item>
		<title>SharePoint 2010: Set session timeout and setup sliding sessions on an FBA enabled site</title>
		<link>http://jasear.wordpress.com/2011/01/10/sharepoint-2010-set-session-timout-on-a-fba-enabled-site/</link>
		<comments>http://jasear.wordpress.com/2011/01/10/sharepoint-2010-set-session-timout-on-a-fba-enabled-site/#comments</comments>
		<pubDate>Mon, 10 Jan 2011 00:07:19 +0000</pubDate>
		<dc:creator>jasear</dc:creator>
				<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[ASP.net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Session timeout]]></category>
		<category><![CDATA[Session Token]]></category>
		<category><![CDATA[sharepoint]]></category>

		<guid isPermaLink="false">http://jasear.wordpress.com/?p=201</guid>
		<description><![CDATA[After struggling with this for a few days I finally figured out how to control this in SharePoint 2010. In MOSS 2007 if you had a site that had windows authentication then you could specify the timeout by adding a timeout attribute in the sessionState element in your web.config. On the other hand if you [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jasear.wordpress.com&amp;blog=4155040&amp;post=201&amp;subd=jasear&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>After struggling with this for a few days I finally figured out how to control this in SharePoint 2010.</p>
<p>In MOSS 2007 if you had a site that had windows authentication then you could specify the timeout by adding a timeout attribute in the sessionState element in your web.config. On the other hand if you had an FBA enabled site and wanted to control the session timeout you would do that by adding a timeout attribute in the forms element in the web.config.</p>
<p><strong>The Problem </strong></p>
<p>The problem is that in SharePoint 2010 the same thing does not work for a FBA enabled site. I spent a whole lot of time trying to search for a solution and ended up trying a lot of different things but nothing seemed to work. At one point I came across the powershell script below and thought I had finally found a solution:</p>
<p><pre class="brush: csharp;">
$sts = Get-SPSecurityTokenServiceConfig
$sts.WindowsTokenLifetime = (New-TimeSpan -Minutes 60)
$sts.FormsTokenLifetime = (New-TimeSpan -Minutes 60)
$sts.Update()
</pre></p>
<p>However, soon I realised that this was causing the session to expire after 60 minutes regardless of the activity of the user. Eventually, I came across <a href="https://blogs.pointbridge.com/Blogs/nielsen_travis/Pages/Post.aspx?_ID=41">this</a> very useful blog post.</p>
<p><strong>The Solution</strong></p>
<p>First of all we need to add some code behind to the Global.asax file of the SharePoint Web Application. </p>
<p>In your Visual Studio project add a new class file and call it Global.asax.cs (you can call it anything really) Then we need to add the following code to the Global.asax.cs file:</p>
<p><pre class="brush: csharp;">
namespace MyNameSpace
{
    public class Global : SPHttpApplication
    {
        /// &lt;summary&gt;
        /// Executes custom initialization code after all event handler modules have been added.
        /// &lt;/summary&gt;
        public override void Init()
        {
            FederatedAuthentication.SessionAuthenticationModule.SessionSecurityTokenReceived += new EventHandler&lt;SessionSecurityTokenReceivedEventArgs&gt;(SessionAuthenticationModule_SessionSecurityTokenReceived);
            base.Init();
        }

        /// &lt;summary&gt;
        /// Handles the Start event of the Application control.
        /// &lt;/summary&gt;
        /// &lt;param name=&quot;sender&quot;&gt;The source of the event.&lt;/param&gt;
        /// &lt;param name=&quot;e&quot;&gt;The &lt;see cref=&quot;System.EventArgs&quot;/&gt; instance containing the event data.&lt;/param&gt;
        void Application_Start(object sender, EventArgs e)
        {
        }

        /// &lt;summary&gt;
        /// Handles the SessionSecurityTokenReceived event of the SessionAuthenticationModule control.
        /// &lt;/summary&gt;
        /// &lt;param name=&quot;sender&quot;&gt;The source of the event.&lt;/param&gt;
        /// &lt;param name=&quot;e&quot;&gt;The &lt;see cref=&quot;Microsoft.IdentityModel.Web.SessionSecurityTokenReceivedEventArgs&quot;/&gt; instance containing the event data.&lt;/param&gt;
        void SessionAuthenticationModule_SessionSecurityTokenReceived(object sender, SessionSecurityTokenReceivedEventArgs e)
        {
            // the timeout comes from the web.config
            int configuredTokenTimeout = Convert.ToInt32(ConfigurationManager.AppSettings[&quot;SessionTokenTimeout&quot;]);

            DateTime now = DateTime.UtcNow;
            DateTime validFrom = e.SessionToken.ValidFrom;
            DateTime validTo = e.SessionToken.ValidTo;

            long timeLeft = e.SessionToken.ValidTo.Subtract(now).Ticks;
            TimeSpan tokenLifeTime = validTo.Subtract(validFrom);
            TimeSpan configuredTokenTimeSpan = new TimeSpan(0, configuredTokenTimeout, 0);
            // 37200000000 = 62 minutes
            if ((tokenLifeTime.Ticks &gt; configuredTokenTimeSpan.Ticks) || (timeLeft * 2) &lt; tokenLifeTime.Ticks)
            {
                SPSessionAuthenticationModule spsam = sender as SPSessionAuthenticationModule;
                e.SessionToken = spsam.CreateSessionSecurityToken(e.SessionToken.ClaimsPrincipal, e.SessionToken.Context,
                    now, now.AddMinutes(configuredTokenTimeout), true);
                e.ReissueCookie = true;
            }
        }
    }
</pre></p>
<p>Next we need to link this code behind to the Global.asax file.</p>
<p>Browse to the root of your Web Application Folder and open up the Global.asax file and add the following (modify the application tag with your specific assembly details):</p>
<p><pre class="brush: csharp;">
&lt;%@ Assembly Name=&quot;Microsoft.SharePoint&quot;%&gt;
&lt;%@ Application Language=&quot;C#&quot; Inherits=&quot;MyNameSpace.Global,MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d4469032123b3e99a&quot;%&gt; 
</pre></p>
<p>Deploy your solution.</p>
<p>In the example above I am subscribing to the SessionSecurityTokenReceived event. In it I have some custom logic to implement a sliding session. Basically what I am doing is that I discard the original session token (which always seems to have a lifetime of 10 hours) and I create a new session token that has the lifetime I want. In my implementation I also added a key in the appsettings section of the web.config that controls the session timeout value:</p>
<p><pre class="brush: csharp;">
  &lt;appSettings&gt;
    .......
    &lt;add key=&quot;SessionTokenTimeout&quot; value=&quot;60&quot; /&gt;
    .........
</pre></p>
<p>Finally, I found that you need to run the following powershell script below as well to make the whole thing work:</p>
<p><pre class="brush: csharp;">
$sts = Get-SPSecurityTokenServiceConfig
$sts.LogonTokenCacheExpirationWindow = (New-TimeSpan –seconds 1)
// set it to false for better client integration (thanks to Anirudh for pointing this out)
$sts.UseSessionCookies = $false
$sts.Update()
iisreset 
</pre></p>
<p>This is the only way I found that allowed me to control the Session Timeout in 2010. Please feel free to leave a comment if you have found a better and easier solution.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jasear.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jasear.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jasear.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jasear.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jasear.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jasear.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jasear.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jasear.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jasear.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jasear.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jasear.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jasear.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jasear.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jasear.wordpress.com/201/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jasear.wordpress.com&amp;blog=4155040&amp;post=201&amp;subd=jasear&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jasear.wordpress.com/2011/01/10/sharepoint-2010-set-session-timout-on-a-fba-enabled-site/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c1b64111045e82b6dda5c652ed445c9f?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">jasear</media:title>
		</media:content>
	</item>
		<item>
		<title>Custom Action to Trigger a SharePoint Timer Job</title>
		<link>http://jasear.wordpress.com/2010/11/27/custom-action-to-trigger-a-sharepoint-timer-job/</link>
		<comments>http://jasear.wordpress.com/2010/11/27/custom-action-to-trigger-a-sharepoint-timer-job/#comments</comments>
		<pubDate>Sat, 27 Nov 2010 00:37:24 +0000</pubDate>
		<dc:creator>jasear</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[MOSS 2007]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[2010]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[sharepoint]]></category>
		<category><![CDATA[Sharepoint 2010]]></category>
		<category><![CDATA[SharePoint Timer Job]]></category>

		<guid isPermaLink="false">http://jasear.wordpress.com/?p=188</guid>
		<description><![CDATA[In my last post I demonstrated how to create a SharePoint Custom Action to appear on a specific SharePoint List. When a user clicked the action it ran some of our custom code. Today we will try to extend that example and run a SharePoint Timer Job on the click of our custom action. I [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jasear.wordpress.com&amp;blog=4155040&amp;post=188&amp;subd=jasear&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In my <a href="http://jasear.wordpress.com/2010/11/21/sharepoint-2010-custom-action-that-executes-custom-code/">last post</a> I demonstrated how to create a SharePoint Custom Action to appear on a specific SharePoint List. When a user clicked the action it ran some of our custom code.</p>
<p>Today we will try to extend that example and run a SharePoint Timer Job on the click of our custom action.</p>
<p>I am making the following assumptions:</p>
<ul>
<li>You have read my <a title="SharePoint 2010: Custom action that executes custom code" href="http://jasear.wordpress.com/2010/11/21/sharepoint-2010-custom-action-that-executes-custom-code/">previous post</a> and have created the custom action</li>
<li>You know how to create and deploy Custom Timer Job definitions</li>
</ul>
<p><strong>The Problem</strong></p>
<p>SharePoint Timer Job instances are persisted in the configuration database. Typically the SharePoint Farm service account or other accounts that have been given permissions on this database explicitly are able to write to this database.</p>
<p>For this reason when you try to execute a SharePoint Timer Job from within a site collection it will generally fail even if you run it within a SPSecurity.RunWithElevatedPrivileges code block. Running with elevated priviledges results in the code being run in the context of the Application Pool account (referred to as the System Account by SharePoint). Unless you have deviated from the best practices guidelines this will result in the following error:</p>
<p><code>Security Exception<br />
Description: The application attempted to perform an operation not allowed by the security policy.  To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file. </p>
<p>Exception Details: System.Security.SecurityException: Access denied.<br />
</code></p>
<p>You could always get around this by explicitly giving the Application Pool account permissions on the Configuration Database or by setting the Farm account as also being the Application Pool account for your Web Application. However, both these approaches are not recommended and are a deviation from the best practices guidelines.</p>
<p><strong>The Solution</strong></p>
<p>In my previous blog post, we created a custom action and deployed it. We used our custom action to send the user to a custom aspx page (with code-behind) that was located in the layouts folder. In the code behind we ran the custom code we wanted to execute. In this way we were able to create a custom action that ran some custom code on the click of our custom action. </p>
<p>To use our custom action to trigger a SharePoint Timer Job we need to add the following code in the aspx code-behind page:</p>
<p><pre class="brush: csharp;">namespace MyProject.CustomJobDefinitions
{
    public class JobInitiator: SPJobDefinition
    {
        public JobInitiator()
            : base()
        {
        }
        public JobInitiator(string jobName, SPService service, SPServer server, SPJobLockType targetType)	 
	            : base(jobName, service, server, targetType)
        {
	 
        }
        public JobInitiator(string jobName, SPWebApplication webApplication)
            : base(jobName, webApplication, null, SPJobLockType.None)
        {
            this.Title = &quot;JobInitiator&quot;;
        }
         public override void Execute(Guid targetInstanceId)
        {
            using (SPSite site = this.WebApplication.Sites[&quot;/&quot;])
            {
                using (SPWeb web = site.RootWeb)
                {
                    if (web.Properties[&quot;InitiatorJobFlag&quot;] != null)
                    {
                        // Reset the flag 
                        Helper.SetSiteProperty(site, &quot;InitiatorJobFlag&quot;, null);
                        // This is the job we want to run that does some stuff. It could be any job we want to run
                        CustomJobToRun process = new CustomJobToRun(&quot;My Job&quot;, WebApplication);
                        process.Execute(targetInstanceId);
                    }
                }
            }
        } 
    }
}
</pre><br />
And below is the very useful &#8216;SetSiteProperty&#8217; helper method:</p>
<p><pre class="brush: csharp;">
        public static void SetSiteProperty(SPSite site, string propertyName, string value)
        {
            bool unsafeUpdateValue = site.RootWeb.AllowUnsafeUpdates;
            site.RootWeb.AllowUnsafeUpdates = true;
            if (site.RootWeb.Properties.ContainsKey(propertyName))
            {
                site.RootWeb.Properties[propertyName] = value;
            }
            else
            {
                site.RootWeb.Properties.Add(propertyName, value);
            }

            site.RootWeb.Properties.Update();
            site.RootWeb.AllowUnsafeUpdates = unsafeUpdateValue;
        }
</pre></p>
<p>Now that we have created our Custom Timer Job Definition, we can create a feature (scoped at Farm or WebApplication) and in the FeatureReciever feature activated event we add the following code:</p>
<p><pre class="brush: csharp;">
JobInitiator job = new JobInitiator(&quot;JobInitiator&quot;, webApp)
            {
                Schedule = new SPMinuteSchedule
                {
                    BeginSecond = 0,
                    EndSecond = 59,
                    Interval = 1
                }
            };
            job.Update(true);
</pre></p>
<p>The schedule above ensures that our Custom Timer Job will run every minute. So our timer job executes every single minute and checks a property on the RootWeb of our Site Collection. If this property is set then it runs the specified Job of our choice.</p>
<p>And then finally in the code-behind file of our aspx page we add the following code:<br />
<pre class="brush: csharp;">
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            Helper.SetSiteProperty(SPContext.Current.Site, &quot;InitiatorJobFlag&quot;, &quot;RunNow&quot;);
        }
</pre></p>
<p>So there we have it, by following this way we were able to create a Custom Action that, when clicked, triggers any SharePoint Timer Job we would like to run.</p>
<p>You might wonder why am I using a Job to execute another Job? Well there could be a scenario where you might want to run an OTB SharePoint Timer Job in which case this way would work. </p>
<p>In my specific scenario I had created a Job that was scheduled to run once every day. By using the above method I can easily trigger the execution of this Job on demand without interfering with its normal schedule. </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jasear.wordpress.com/188/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jasear.wordpress.com/188/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jasear.wordpress.com/188/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jasear.wordpress.com/188/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jasear.wordpress.com/188/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jasear.wordpress.com/188/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jasear.wordpress.com/188/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jasear.wordpress.com/188/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jasear.wordpress.com/188/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jasear.wordpress.com/188/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jasear.wordpress.com/188/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jasear.wordpress.com/188/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jasear.wordpress.com/188/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jasear.wordpress.com/188/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jasear.wordpress.com&amp;blog=4155040&amp;post=188&amp;subd=jasear&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jasear.wordpress.com/2010/11/27/custom-action-to-trigger-a-sharepoint-timer-job/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c1b64111045e82b6dda5c652ed445c9f?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">jasear</media:title>
		</media:content>
	</item>
		<item>
		<title>SharePoint 2010: Custom action that executes custom code</title>
		<link>http://jasear.wordpress.com/2010/11/21/sharepoint-2010-custom-action-that-executes-custom-code/</link>
		<comments>http://jasear.wordpress.com/2010/11/21/sharepoint-2010-custom-action-that-executes-custom-code/#comments</comments>
		<pubDate>Sun, 21 Nov 2010 17:36:14 +0000</pubDate>
		<dc:creator>jasear</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[MOSS 2007]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[2010]]></category>
		<category><![CDATA[ASP.net]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[sharepoint]]></category>
		<category><![CDATA[Sharepoint 2010]]></category>
		<category><![CDATA[web parts]]></category>

		<guid isPermaLink="false">http://jasear.wordpress.com/?p=151</guid>
		<description><![CDATA[In 2007 it was possible to create a custom action and then link it to some code. You did this by first declaring your custom action in an elements.xml file (which you would then deploy as part of a feature): In the ControlAssembly and ControlClass attributes you specified your custom assembly and your custom class [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jasear.wordpress.com&amp;blog=4155040&amp;post=151&amp;subd=jasear&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In 2007 it was possible to create a custom action and then link it to some code. </p>
<p>You did this by first declaring your custom action in an elements.xml file (which you would then deploy as part of a feature):</p>
<p><pre class="brush: xml;">
&lt;Elements xmlns=&quot;http://schemas.microsoft.com/sharepoint/&quot;&gt;
  &lt;CustomAction
    Id=&quot;MyCustomAction&quot;
    RegistrationType=&quot;List&quot;
    GroupId=&quot;ActionsMenu&quot;
    Location=&quot;Microsoft.SharePoint.StandardMenu&quot;
    Sequence=&quot;1000&quot;
    ControlAssembly=&quot;[Fully qualified assembly name]&quot;
    ControlClass=&quot;MyNamespace.MyCustomAction&quot;&gt;
  &lt;/CustomAction&gt;
&lt;/Elements&gt;
</pre></p>
<p>In the ControlAssembly and ControlClass attributes you specified your custom assembly and your custom class (a WebControl) that contained your custom code.</p>
<p>Then you created your custom WebControl:</p>
<p><pre class="brush: csharp;">
public class MyCustomAction : WebControl 
{
    protected override void CreateChildControls() 
    {
        // Do some stuff
    }
}
</pre></p>
<p>Using this way we were able able to execute some custom code when someone clicked our custom action.</p>
<p>However, it seems that we cannot use this method in SharePoint 2010 although there are a few workarounds to achieve the same result. Below I will show you a way I used.</p>
<p>To start off with, I created an elements.xml file with the following declaration:</p>
<p><pre class="brush: xml;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;Elements xmlns=&quot;http://schemas.microsoft.com/sharepoint/&quot;&gt;
  &lt;CustomAction Id=&quot;ContentTypeRibbonCustomization&quot; RegistrationId=&quot;10005&quot; RegistrationType=&quot;List&quot; Location=&quot;CommandUI.Ribbon.ListView&quot; Sequence=&quot;95&quot; Title=&quot;Run Custom Code&quot;&gt;
    &lt;CommandUIExtension&gt;
      &lt;CommandUIDefinitions&gt;
        &lt;CommandUIDefinition Location=&quot;Ribbon.List.Settings.Controls._children&quot;&gt;
          &lt;Button Id=&quot;ContentTypeTest.Button&quot; Image16by16=&quot;/_layouts/images/LSTPEND.gif&quot; Image32by32=&quot;/_layouts/images/centraladmin_configurationwizards_farmconfiguration_32x32.png&quot; Command=&quot;ContentTypeCommand&quot; CommandType=&quot;General&quot; Description=&quot;Runs some custom Code&quot; TemplateAlias=&quot;o2&quot; Sequence=&quot;95&quot; LabelText=&quot;Perform My Action&quot;/&gt;
        &lt;/CommandUIDefinition&gt;
      &lt;/CommandUIDefinitions&gt;
      &lt;CommandUIHandlers&gt;
        &lt;CommandUIHandler Command=&quot;ContentTypeCommand&quot; CommandAction=&quot;/MyWeb/_layouts/CustomPages/MyCustomApplicationPage.aspx&quot; /&gt;
      &lt;/CommandUIHandlers&gt;
    &lt;/CommandUIExtension&gt;
  &lt;/CustomAction&gt;
&lt;/Elements&gt;
</pre></p>
<p>This specifies that my Custom Action will appear on my custom list with TemplateType of 10005 (specified in the RegistrationId attribute) in the list view section.</p>
<p>I then used a Feature to depoy my Custom Action.</p>
<p>All my Custom Action does is to send the user to a custom page that is located in the Layouts folder:</p>
<p>/MyWeb/_layouts/CustomPages/MyCustomApplicationPage.aspx</p>
<p>I then created my custom aspx page. Below is the mark up for the page:</p>
<p><pre class="brush: plain;">
&lt;%@ Assembly Name=&quot;MyCustomAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=e246903334b3e97b&quot; %&gt;
&lt;%@ Page Language=&quot;C#&quot; AutoEventWireup=&quot;true&quot; Inherits=&quot;MyCustomNamespace.MyCustomControl&quot;
    Debug=&quot;true&quot; %&gt;
</pre></p>
<p>And finally, below is the code behind for the aspx page:</p>
<p><pre class="brush: csharp;">namespace MyCustomNamespace
{
    public class MyCustomControl: UserControl
    {    
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            // run some custom code
            // then redirect the user back to the original page
        }
    }
}</pre></p>
<p>Using this way I was able to link some custom code that would execute in response to someone clicking my custom action.</p>
<p>For everything you need to know about customising the SharePoin Ribbon please <a href="http://www.sharepointnutsandbolts.com/2010/01/customizing-ribbon-part-1-creating-tabs.html">go here to Chris O&#8217;Brien&#8217;s blog post</a>.</p>
<p>After spending a lot of time investigating how to customise the Ribbon to meet the requirements I had I can safely say this is by far the best and most comprehensive blog post I found on the net.</p>
<p>As I said earlier there are other ways you can use to achieve the same objective. You can easily link a custom action to execute some javascript function. I guess one option would be to link it to a javascript function that then invoked some server side code. I havent tried this myself so I cannot say for sure if this approach would work. </p>
<p>If you had a similar issue to the one I had above, I would be interested in hearing what approach you used to resolve it (if different to the approach I used).</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jasear.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jasear.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jasear.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jasear.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jasear.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jasear.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jasear.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jasear.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jasear.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jasear.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jasear.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jasear.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jasear.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jasear.wordpress.com/151/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jasear.wordpress.com&amp;blog=4155040&amp;post=151&amp;subd=jasear&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jasear.wordpress.com/2010/11/21/sharepoint-2010-custom-action-that-executes-custom-code/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c1b64111045e82b6dda5c652ed445c9f?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">jasear</media:title>
		</media:content>
	</item>
		<item>
		<title>How To: Enable Incomming emails on a Custom SharePoint List</title>
		<link>http://jasear.wordpress.com/2010/11/11/how-to-enable-incomming-emails-on-a-custom-sharepoint-list/</link>
		<comments>http://jasear.wordpress.com/2010/11/11/how-to-enable-incomming-emails-on-a-custom-sharepoint-list/#comments</comments>
		<pubDate>Thu, 11 Nov 2010 13:34:53 +0000</pubDate>
		<dc:creator>jasear</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[MOSS 2007]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[2010]]></category>
		<category><![CDATA[ASP.net]]></category>
		<category><![CDATA[Incoming emails]]></category>
		<category><![CDATA[Lists]]></category>
		<category><![CDATA[sharepoint]]></category>

		<guid isPermaLink="false">http://jasear.wordpress.com/?p=143</guid>
		<description><![CDATA[First of all if this list is hosted in a Meeting Workspace Web then this will not work. Please refer to this post for complete details. Briefly, this is what you need to do: Create your custom SharePoint list Attach an Event handler of type &#8216;EmailReceived&#8217; to your list (once you do this the &#8216;Incoming [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jasear.wordpress.com&amp;blog=4155040&amp;post=143&amp;subd=jasear&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>First of all if this list is hosted in a Meeting Workspace Web then this will not work. Please refer to <a href="http://jasear.wordpress.com/2010/11/11/enable-incoming-emails-on-a-custom-sharepoint-list/">this post</a> for complete details.</p>
<p>Briefly, this is what you need to do:</p>
<ul>
<li>Create your custom SharePoint list</li>
<li>Attach an Event handler of type &#8216;EmailReceived&#8217; to your list (once you do this the &#8216;Incoming Email Settings&#8217; option will appear in the List Settings section of the site)</li>
<li>Add some code to your event handler as per your requirements to process the email</li>
<li>Deploy your list the usual way and create an instance of it (could be done as part of the deployment or via the UI)</li>
</ul>
<p>In the example below I am picking up the subject of the email, creating a new list item where I set the title field value to match the subject. This is a very simple example but you can do a whole lot of stuff in this event handler such as processing attachments e.t.c.</p>
<p><pre class="brush: csharp;">public override void EmailReceived(SPList list, SPEmailMessage emailMessage, String receiverData)
{
    SPListItem newItem = list.Items.Add();
    newItem[&quot;Title&quot;] = emailMessage.Headers[&quot;subject&quot;]
    newItem.Update();
}
</pre></p>
<p>For complete details on how to configure your environment to facilitate processing of incoming emails please <a href="http://jasear.wordpress.com/2010/11/11/enable-incoming-emails-on-a-custom-sharepoint-list/">click here</a> or <a href="http://mosshowto.blogspot.com/2010/05/installing-smtp-pop3-sharepoint-2010.html">here</a>. There is also a very useful technet video on the subject <a href="http://technet.microsoft.com/en-us/sharepoint/ff679958.aspx">here</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jasear.wordpress.com/143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jasear.wordpress.com/143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jasear.wordpress.com/143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jasear.wordpress.com/143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jasear.wordpress.com/143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jasear.wordpress.com/143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jasear.wordpress.com/143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jasear.wordpress.com/143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jasear.wordpress.com/143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jasear.wordpress.com/143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jasear.wordpress.com/143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jasear.wordpress.com/143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jasear.wordpress.com/143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jasear.wordpress.com/143/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jasear.wordpress.com&amp;blog=4155040&amp;post=143&amp;subd=jasear&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jasear.wordpress.com/2010/11/11/how-to-enable-incomming-emails-on-a-custom-sharepoint-list/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c1b64111045e82b6dda5c652ed445c9f?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">jasear</media:title>
		</media:content>
	</item>
		<item>
		<title>Enable Incoming emails on a Custom SharePoint List</title>
		<link>http://jasear.wordpress.com/2010/11/11/enable-incoming-emails-on-a-custom-sharepoint-list/</link>
		<comments>http://jasear.wordpress.com/2010/11/11/enable-incoming-emails-on-a-custom-sharepoint-list/#comments</comments>
		<pubDate>Thu, 11 Nov 2010 13:14:10 +0000</pubDate>
		<dc:creator>jasear</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[MOSS 2007]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[ASP.net]]></category>
		<category><![CDATA[Custom List]]></category>
		<category><![CDATA[Incoming emails]]></category>
		<category><![CDATA[sharepoint]]></category>
		<category><![CDATA[Sharepoint 2010]]></category>

		<guid isPermaLink="false">http://jasear.wordpress.com/?p=129</guid>
		<description><![CDATA[We had a requirement recently whereby we needed to create a custom SharePoint list that would accept incoming emails. This post is going to be very long so bear with me &#8230; Initially, I was very optimisitic that all I needed to do was to setup incoming notifications via Central Administration and then turn on [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jasear.wordpress.com&amp;blog=4155040&amp;post=129&amp;subd=jasear&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>We had a requirement recently whereby we needed to create a custom SharePoint list that would accept incoming emails. This post is going to be very long so bear with me &#8230;</p>
<p>Initially, I was very optimisitic that all I needed to do was to setup incoming notifications via Central Administration and then turn on Incoming Email notifications on the list itself and it should all fall into place.</p>
<p>How wrong I was! </p>
<p><strong>Setting up the Development Enviornment</strong></p>
<p>The first thing you have to do is to setup your development enviornment so that you can send emails and your SharePoint list can recieve them. This turned out to be a massive task. I spent hours searching through blogs, forums and various sites to try and setup the infrastructure on my dev (Hyper-v VM based) enviornment but I just could not get it to work. Eventually I stubmled upon <a href="http://mosshowto.blogspot.com/2010/05/installing-smtp-pop3-sharepoint-2010.html">this post</a> from Marc Charmois that explained in detail how to get the whole thing to work on your Dev enriornment:</p>
<p><strong>Enabling Incoming-emails on the SharePoint List. The Problem:</strong></p>
<p>Ok, so I created a custom SharePoint List went to List Settings and looked for the &#8216;In-coming email settings&#8217; link under the &#8216;Communication&#8217; settings and found it to be non-existent. Googling on this brought all sorts of theories, hearsay and rumours to light. Some thought that this option was only available on x,y or z type of lists then there were others that thought it was only available on a,b,c or d type of lists but one thing was for sure no one seemed to know for a fact what was actually going on. As I was looking at the object model I found a property on the SPList object called &#8216;CanReceieveEmail&#8217;. I thought maybe this was the answer i.e. all I needed to do was to get my list and set this property to true and it will all work. However you cannot set this property you can only get its value. I believe this property is used by the SharePoint UI to decide whether or not to show the &#8216;In-coming Email Settings&#8217; link in the list settings area.</p>
<p>So it was time to fire up Reflector to find a way to set this property maybe through reflection?</p>
<p>Looking at the property via reflection I found:</p>
<p><pre class="brush: csharp;">
public bool get_CanReceiveEmail()
{
    if (!SPEmailHandler.HasHandler(this.BaseTemplate) &amp;&amp; !this.HasExternalEmailHandler)
    {
        return false;
    }
    return !SPMeeting.IsMeetingWorkspaceWeb(this.ParentWeb);
}
</pre></p>
<p>And ..</p>
<p><pre class="brush: csharp;">
public static bool HasHandler(SPListTemplateType templateType)
{
    if ((((templateType != SPListTemplateType.Announcements) &amp;&amp; (templateType !=    SPListTemplateType.Events)) &amp;&amp; ((templateType != SPListTemplateType.DocumentLibrary)  &amp;&amp; (templateType != SPListTemplateType.PictureLibrary))) &amp;&amp; ((templateType !=  SPListTemplateType.XMLForm) &amp;&amp; (templateType != SPListTemplateType.DiscussionBoard)))
    {
        return (templateType == SPListTemplateType.Posts);
    }
    return true;
}
</pre></p>
<p>And finally &#8230;.</p>
<p><pre class="brush: csharp;">
internal bool HasExternalEmailHandler
{
    get
    {
        bool flag = false;
        foreach (SPEventReceiverDefinition definition in this.EventReceivers)
        {
            if (definition.Type == SPEventReceiverType.EmailReceived)
            {
                flag = true;
            }
        }
        return flag;
    }
}
</pre></p>
<p>From this we can determine the following:</p>
<p>If the list, regardless of its type, appears in a meeting workspace web it will not be able to recieve in-coming emails.</p>
<p>The list either needs to have the BaseTemplate of one of the following:</p>
<ul>
<li><code>Announcements</code></li>
<li><code>Events</code></li>
<li><code>DocumentLibrary</code></li>
<li><code>PictureLibrary</code></li>
<li><code>XMLForm</code></li>
<li><code>DiscussionBoard</code></li>
<li><code>Posts</code></li>
</ul>
<p>or it needs to have an event handler of type &#8216;EmailReceived&#8217; attached to it.</p>
<p>An important point to note here is that it mentions the base template which should not be mistaken for the BaseType. What this means is that you could create a custom list that inherits from the BaseType Document Library but that does not mean that it will have incoming emails enabled. Your list will need to have the same BaseTemplate as the out of the box lists mentioned above which is not really ideal. </p>
<p><strong>Enabling Incoming-emails on the SharePoint List. The Solution:</strong></p>
<p>So the only route left for me to take was to go the Event Handler path. I attached the Event Handler (and the incomming email settings link started to appear in the list settings area) then sent an email to my list and debugged my code with a break point on my event handler. However it just never seemed to get hit and neither were my emails appearing in the list itself.</p>
<p>The mistake I was making was to attach the w3wp process but this is not the process that processes the incoming emails. I dont want to go into this in detail but the incoming emails are processed by a SharePoint job that runs every minute therefore the process I needed to attach was the OWSTimer process. Once I attached this process it started to hit my break point however the emails were still not appearing in the list.</p>
<p>One thing to note here is that whenever you make any code changes to this event handler, after you deploy the dll&#8217;s to GAC, you need to ensure you restart the SharePoint Timer Job Service because it holds a cached version of the dll&#8217;s.</p>
<p>Finally, the reason the emails were not appearing in the list was because this needs to be done via the Event Handler. For the lists that are from one of the Templates I mentioned above SharePoint understands how to process and add the email messages however for your own custom list it is down to the Developer to write the code to do this processing. The event handler though provides you an object of type SPEmailMessage which has all the data you require. Below is an example of how it can be used to add the email subject to a simple custom list with only a title field:</p>
<p><pre class="brush: csharp;">
public override void EmailReceived(SPList list, SPEmailMessage emailMessage, String receiverData)
{
    SPListItem newItem = list.Items.Add();
    newItem[&quot;Title&quot;] = emailMessage.Headers[&quot;subject&quot;]
    newItem.Update();
}
</pre></p>
<p>You can easily extend it to deal with attachments as well but that is for another day!</p>
<p>P.S Illustrations to be added soon&#8230;.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jasear.wordpress.com/129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jasear.wordpress.com/129/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jasear.wordpress.com/129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jasear.wordpress.com/129/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jasear.wordpress.com/129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jasear.wordpress.com/129/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jasear.wordpress.com/129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jasear.wordpress.com/129/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jasear.wordpress.com/129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jasear.wordpress.com/129/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jasear.wordpress.com/129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jasear.wordpress.com/129/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jasear.wordpress.com/129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jasear.wordpress.com/129/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jasear.wordpress.com&amp;blog=4155040&amp;post=129&amp;subd=jasear&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jasear.wordpress.com/2010/11/11/enable-incoming-emails-on-a-custom-sharepoint-list/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c1b64111045e82b6dda5c652ed445c9f?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">jasear</media:title>
		</media:content>
	</item>
	</channel>
</rss>
