<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Dev Team Assemble &#187; Development</title>
	<atom:link href="http://www.calvinirwin.net/tag/development/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.calvinirwin.net</link>
	<description>Evil beware!</description>
	<lastBuildDate>Wed, 28 Jul 2010 12:55:01 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Site Collection Images and ImageFieldValue</title>
		<link>http://www.calvinirwin.net/2009/11/26/site-collection-images-and-imagefieldvalue/</link>
		<comments>http://www.calvinirwin.net/2009/11/26/site-collection-images-and-imagefieldvalue/#comments</comments>
		<pubDate>Fri, 27 Nov 2009 03:33:46 +0000</pubDate>
		<dc:creator>Calvin</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[moss 2007]]></category>
		<category><![CDATA[SharePoint]]></category>

		<guid isPermaLink="false">http://www.calvinirwin.net/?p=237</guid>
		<description><![CDATA[One of the things I was working on today was trying to get an actual image from the library was that initially I was expecting to get a PublishingImage.  All the samples on MSDN and the ones strewn about the web refer to using the ImageFieldValue and getting it from a field in the SPListItem.  [...]]]></description>
			<content:encoded><![CDATA[<p>One of the things I was working on today was trying to get an actual image from the library was that initially I was expecting to get a PublishingImage.  All the samples on MSDN and the ones strewn about the web refer to using the ImageFieldValue and getting it from a field in the SPListItem.  Like outlined on <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.publishing.fields.imagefieldvalue.aspx">MSDN </a>:</p>
<pre class="csharp">  <span style="color: #008080; font-style: italic;">// Retrieve the current value from an SPListItem with a</span>
  <span style="color: #008080; font-style: italic;">// column of the ImageField type with the name imageFieldName</span>
  ImageFieldValue currentFieldValue =
        listItemWithImageField<span style="color: #000000;">&#91;</span>imageFieldName<span style="color: #000000;">&#93;</span> <span style="color: #0600FF;">as</span> ImageFieldValue;</pre>
<p>The problem is this only works for images that are in a list, like the PublishingRollupImage of a page that links to an image in the Site Collection Images library.  The actual images in the library are stored as documents (Referenced using SPFile) so in order utilize them I need to extract the information out and create an image tag for it...like so:</p>
<pre class="csharp">&nbsp;
     ImageFieldValue imageValue = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> ImageFieldValue<span style="color: #000000;">&#40;</span>
          <span style="color: #FF0000;">string</span>.<span style="color: #0000FF;">Format</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;&lt;img src=<span style="color: #008080; font-weight: bold;">\&quot;</span>{0}<span style="color: #008080; font-weight: bold;">\&quot;</span> alt=<span style="color: #008080; font-weight: bold;">\&quot;</span>{1}<span style="color: #008080; font-weight: bold;">\&quot;</span> /&gt;&quot;</span>,
          file.<span style="color: #0000FF;">Url</span>, file.<span style="color: #0000FF;">Title</span> == <span style="color: #0600FF;">null</span> ? <span style="color: #FF0000;">string</span>.<span style="color: #0000FF;">Empty</span> : file.<span style="color: #0000FF;">Title</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;
&nbsp;</pre>
<p>Now that I had the ImageFieldValue it was easy to work with.  I could manipulate many aspects of the image using this object and then save it for rendering using ToString().  Funny thing is for my purposes (ImageGallery xml generation) I didn't even end up needing this code after all...frustrating but a good learning experience.  </p>
<p>Props to <a href="http://vlifeblog.com">Phanat Chan</a> as he did the initial development on this.</p>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/Development' rel='tag' target='_self'>Development</a>, <a class='technorati-link' href='http://technorati.com/tag/moss+2007' rel='tag' target='_self'>moss 2007</a>, <a class='technorati-link' href='http://technorati.com/tag/SharePoint' rel='tag' target='_self'>SharePoint</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://www.calvinirwin.net/2009/11/26/site-collection-images-and-imagefieldvalue/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ERROR: Incompatible Web Part markup detected. Use &#8220;.dwp web part XML instead of *.webpart web part xml</title>
		<link>http://www.calvinirwin.net/2009/10/09/error-incompatible-web-part-markup-detected-use-dwp-web-part-xml-instead-of-webpart-web-part-xml/</link>
		<comments>http://www.calvinirwin.net/2009/10/09/error-incompatible-web-part-markup-detected-use-dwp-web-part-xml-instead-of-webpart-web-part-xml/#comments</comments>
		<pubDate>Sat, 10 Oct 2009 01:18:15 +0000</pubDate>
		<dc:creator>Calvin</dc:creator>
				<category><![CDATA[.Net Framework]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[web parts]]></category>
		<category><![CDATA[SharePoint]]></category>

		<guid isPermaLink="false">http://www.calvinirwin.net/?p=212</guid>
		<description><![CDATA[I came across this problem recently. Its a little strange and only happened once I changed my base webpart class to inherit from Microsoft.SharePoint.WebPartPages.WebPart. There seems to be two fixes for this problem that I implemented:

remove the XMlNamespace from class declaration
Use a .dwp file instead of a .webpart file in your feature folder




Technorati Tags: Development, [...]]]></description>
			<content:encoded><![CDATA[<p>I came across this problem recently. Its a little strange and only happened once I changed my base webpart class to inherit from Microsoft.SharePoint.WebPartPages.WebPart. There seems to be two fixes for this problem that I implemented:</p>
<ul>
<li>remove the XMlNamespace from class declaration</li>
<li>Use a .dwp file instead of a .webpart file in your feature folder</li>
</ul>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/Development' rel='tag' target='_self'>Development</a>, <a class='technorati-link' href='http://technorati.com/tag/SharePoint' rel='tag' target='_self'>SharePoint</a>, <a class='technorati-link' href='http://technorati.com/tag/web+parts' rel='tag' target='_self'>web parts</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://www.calvinirwin.net/2009/10/09/error-incompatible-web-part-markup-detected-use-dwp-web-part-xml-instead-of-webpart-web-part-xml/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lookup Fields and Content Types</title>
		<link>http://www.calvinirwin.net/2009/09/09/lookup-fields-and-content-types/</link>
		<comments>http://www.calvinirwin.net/2009/09/09/lookup-fields-and-content-types/#comments</comments>
		<pubDate>Wed, 09 Sep 2009 04:43:35 +0000</pubDate>
		<dc:creator>Calvin</dc:creator>
				<category><![CDATA[.Net Framework]]></category>
		<category><![CDATA[Configuration]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[content types]]></category>
		<category><![CDATA[lookup fields]]></category>
		<category><![CDATA[SharePoint]]></category>

		<guid isPermaLink="false">http://www.calvinirwin.net/?p=201</guid>
		<description><![CDATA[For the last little bit I have been working on learning how to package up all site infrastructure into a single feature.  All of this is pretty straight forward and I didn't really have any issues.....UNTIL  I tried to get lookup columns working.
Using CAML
I did some reading on the subject and apparently you can do all [...]]]></description>
			<content:encoded><![CDATA[<p>For the last little bit I have been working on learning how to package up all site infrastructure into a single feature.  All of this is pretty straight forward and I didn't really have any issues.....UNTIL  I tried to get lookup columns working.</p>
<h3>Using CAML</h3>
<p>I did some reading on the subject and apparently you can do all of this using CAML alone.  I came across a<a href="http://blogs.msdn.com/joshuag/archive/2008/03/14/add-sharepoint-lookup-column-declaratively-through-caml-xml.aspx"> post from Josh Gaffery</a> supporting this claim, but I simply could not get this working...so i gave up after spinning my wheels on it for longer than I wanted to.  Josh's approach is to use the list URL as opposed to the GUID that links the column to the source list and he has put up an update explaining it further.  Nonetheless....didn't work for me.</p>
<h3>Using Feature Receiver</h3>
<p>I knew that at this point I would have to take the feature reciever approach and modify the fields in place or create them.  I found two sources that both take different approachs to this problem.</p>
<ul>
<li>Chris O'Brien has put together the a project on <a href="http://www.codeplex.com/SP2007LookupFields">CodePlex </a>that will create the lookup columns at activation time.  This actully sounds like a pretty good approach but unfortunately it didn't work for me.  I dont know if there is something wrong with my environment but I encountered a few errors doing this...things like the fields not rendering on the page layouts and getting the "<strong>The local device name is already in use. (Exception from HRESULT: 0x80070055)</strong>" error.</li>
<li>Waldek Mastykarz has a great post on creating the columns via code <a href="http://blog.mastykarz.nl/sharepoint-programmatically-provisioning-lookup-fields/">here</a>.</li>
</ul>
<p>Basically I took a hybrid approach to doing this by mixing the two approaches mentioned above.  I created a custom XML file that I deploy into the layouts directory and then use a feature reciever to read the xml content and create lookup columns based on this.  I also added a deactiving event to remove the fields when the feature is deactivated.  Heres the feature reciever code:</p>
<pre class="csharp"><span style="color: #0600FF;">public</span> <span style="color: #0600FF;">override</span> <span style="color: #0600FF;">void</span> FeatureActivated<span style="color: #000000;">&#40;</span>SPFeatureReceiverProperties properties<span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            <span style="color: #0600FF;">using</span> <span style="color: #000000;">&#40;</span>SPSite site = properties.<span style="color: #0000FF;">Feature</span>.<span style="color: #0000FF;">Parent</span> <span style="color: #0600FF;">as</span> SPSite<span style="color: #000000;">&#41;</span>
            <span style="color: #000000;">&#123;</span>
                <span style="color: #FF0000;">string</span> contentTypes = <span style="color: #0600FF;">null</span>;
                <span style="color: #FF0000;">string</span> listName = <span style="color: #0600FF;">null</span>;
                <span style="color: #FF0000;">string</span> fieldName = <span style="color: #0600FF;">null</span>;
                <span style="color: #FF0000;">string</span> groupName = <span style="color: #0600FF;">null</span>;
                <span style="color: #FF0000;">string</span> staticName = <span style="color: #0600FF;">null</span>;
                <span style="color: #FF0000;">string</span> lookupFieldName = <span style="color: #808080;">&quot;Title&quot;</span>;
                <span style="color: #FF0000;">bool</span> mult = <span style="color: #0600FF;">false</span>;
                <span style="color: #FF0000;">bool</span> required = <span style="color: #0600FF;">false</span>;
                <span style="color: #FF0000;">string</span> filePath = properties.<span style="color: #0000FF;">Feature</span>.<span style="color: #0000FF;">Properties</span><span style="color: #000000;">&#91;</span>
                   <span style="color: #808080;">&quot;ColumnDefinitionPath&quot;</span><span style="color: #000000;">&#93;</span>.<span style="color: #0000FF;">Value</span>;
&nbsp;
                XmlTextReader xReader = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> XmlTextReader<span style="color: #000000;">&#40;</span>
                  HttpContext.<span style="color: #0000FF;">Current</span>.<span style="color: #0000FF;">Server</span>.<span style="color: #0000FF;">MapPath</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">@"~\_layouts\&quot;</span> + filePath<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;
                <span style="color: #0600FF;">while</span> <span style="color: #000000;">&#40;</span>xReader.<span style="color: #0000FF;">Read</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
                <span style="color: #000000;">&#123;</span>
                    <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>xReader.<span style="color: #0000FF;">LocalName</span> == <span style="color: #808080;">&quot;Field&quot;</span><span style="color: #000000;">&#41;</span>
                    <span style="color: #000000;">&#123;</span>
                        <span style="color: #008080;">#region Get values from attributes</span>
                        <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>xReader.<span style="color: #0000FF;">MoveToAttribute</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;List&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
                        <span style="color: #000000;">&#123;</span>
                            listName = xReader.<span style="color: #0000FF;">Value</span>;
                            xReader.<span style="color: #0000FF;">MoveToElement</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
                        <span style="color: #000000;">&#125;</span>
                        <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>xReader.<span style="color: #0000FF;">MoveToAttribute</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;Name&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
                        <span style="color: #000000;">&#123;</span>
                            fieldName = xReader.<span style="color: #0000FF;">Value</span>;
                            xReader.<span style="color: #0000FF;">MoveToElement</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
                        <span style="color: #000000;">&#125;</span>
                        <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>xReader.<span style="color: #0000FF;">MoveToAttribute</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;StaticName&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
                        <span style="color: #000000;">&#123;</span>
                            staticName = xReader.<span style="color: #0000FF;">Value</span>;
                            xReader.<span style="color: #0000FF;">MoveToElement</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
                        <span style="color: #000000;">&#125;</span>
                        <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>xReader.<span style="color: #0000FF;">MoveToAttribute</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;Group&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
                        <span style="color: #000000;">&#123;</span>
                            groupName = xReader.<span style="color: #0000FF;">Value</span>;
                            xReader.<span style="color: #0000FF;">MoveToElement</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
                        <span style="color: #000000;">&#125;</span>
                        <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>xReader.<span style="color: #0000FF;">MoveToAttribute</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;LookUpField&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
                        <span style="color: #000000;">&#123;</span>
                            lookupFieldName = xReader.<span style="color: #0000FF;">Value</span>;
                            xReader.<span style="color: #0000FF;">MoveToElement</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
                        <span style="color: #000000;">&#125;</span>
                        <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>xReader.<span style="color: #0000FF;">MoveToAttribute</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;ExistInContentTypes&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
                        <span style="color: #000000;">&#123;</span>
                            contentTypes = xReader.<span style="color: #0000FF;">Value</span>;
                            xReader.<span style="color: #0000FF;">MoveToElement</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
                        <span style="color: #000000;">&#125;</span>
                        <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>xReader.<span style="color: #0000FF;">MoveToAttribute</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;Mult&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
                        <span style="color: #000000;">&#123;</span>
                            <span style="color: #FF0000;">bool</span>.<span style="color: #0000FF;">TryParse</span><span style="color: #000000;">&#40;</span>xReader.<span style="color: #0000FF;">Value</span>, <span style="color: #0600FF;">out</span> mult<span style="color: #000000;">&#41;</span>;
                            xReader.<span style="color: #0000FF;">MoveToElement</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
                        <span style="color: #000000;">&#125;</span>
                        <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>xReader.<span style="color: #0000FF;">MoveToAttribute</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;Required&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
                        <span style="color: #000000;">&#123;</span>
                            <span style="color: #FF0000;">bool</span>.<span style="color: #0000FF;">TryParse</span><span style="color: #000000;">&#40;</span>xReader.<span style="color: #0000FF;">Value</span>, <span style="color: #0600FF;">out</span> required<span style="color: #000000;">&#41;</span>;
                            xReader.<span style="color: #0000FF;">MoveToElement</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
                        <span style="color: #000000;">&#125;</span>
&nbsp;
                        <span style="color: #008080;">#endregion</span>
&nbsp;
                        SPFieldLookup lookup = CreateLookupField<span style="color: #000000;">&#40;</span>
                          fieldName, groupName, required, mult, site.<span style="color: #0000FF;">RootWeb</span>,
                          site.<span style="color: #0000FF;">RootWeb</span>.<span style="color: #0000FF;">Lists</span><span style="color: #000000;">&#91;</span>listName<span style="color: #000000;">&#93;</span>, lookupFieldName, staticName<span style="color: #000000;">&#41;</span>;
                        <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>contentTypes != <span style="color: #0600FF;">null</span><span style="color: #000000;">&#41;</span>
                            <span style="color: #0600FF;">foreach</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span> s <span style="color: #0600FF;">in</span> contentTypes.<span style="color: #0000FF;">Split</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">','</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
                            <span style="color: #000000;">&#123;</span>
                                LinkFieldToContentType<span style="color: #000000;">&#40;</span>s.<span style="color: #0000FF;">Trim</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>, <span style="color: #000000;">&#40;</span>SPField<span style="color: #000000;">&#41;</span>lookup<span style="color: #000000;">&#41;</span>;
                            <span style="color: #000000;">&#125;</span>
                    <span style="color: #000000;">&#125;</span>
                <span style="color: #000000;">&#125;</span>
&nbsp;
                xReader.<span style="color: #0000FF;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
            <span style="color: #000000;">&#125;</span>
        <span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">static</span> SPFieldLookup CreateLookupField<span style="color: #000000;">&#40;</span>
          <span style="color: #FF0000;">string</span> fieldName, <span style="color: #FF0000;">string</span> group, <span style="color: #FF0000;">bool</span> required, <span style="color: #FF0000;">bool</span> allowMultipleValues,
          SPWeb w, SPList lookupList, <span style="color: #FF0000;">string</span> lookupField, <span style="color: #FF0000;">string</span> staticName<span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            w.<span style="color: #0000FF;">Fields</span>.<span style="color: #0000FF;">AddLookup</span><span style="color: #000000;">&#40;</span>fieldName, lookupList.<span style="color: #0000FF;">ID</span>,
               lookupList.<span style="color: #0000FF;">ParentWeb</span>.<span style="color: #0000FF;">ID</span>, required<span style="color: #000000;">&#41;</span>;
            SPFieldLookup lookup = <span style="color: #000000;">&#40;</span>SPFieldLookup<span style="color: #000000;">&#41;</span>w.<span style="color: #0000FF;">Fields</span><span style="color: #000000;">&#91;</span>fieldName<span style="color: #000000;">&#93;</span>;
            lookup.<span style="color: #0000FF;">AllowMultipleValues</span> = allowMultipleValues;
            lookup.<span style="color: #0000FF;">LookupField</span> = lookupField;
            lookup.<span style="color: #0000FF;">StaticName</span> = staticName;
            lookup.<span style="color: #0000FF;">Group</span> = group;
            lookup.<span style="color: #0000FF;">Update</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">true</span><span style="color: #000000;">&#41;</span>;
            <span style="color: #0600FF;">return</span> lookup;
        <span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">static</span> <span style="color: #0600FF;">void</span> LinkFieldToContentType<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span> contentType, SPField field<span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            <span style="color: #0600FF;">using</span> <span style="color: #000000;">&#40;</span>SPSite site = SPContext.<span style="color: #0000FF;">Current</span>.<span style="color: #0000FF;">Web</span>.<span style="color: #0000FF;">Site</span> <span style="color: #0600FF;">as</span> SPSite<span style="color: #000000;">&#41;</span>
            <span style="color: #000000;">&#123;</span>
                SPContentType ct = site.<span style="color: #0000FF;">RootWeb</span>.<span style="color: #0000FF;">ContentTypes</span><span style="color: #000000;">&#91;</span>contentType<span style="color: #000000;">&#93;</span>;
                ct.<span style="color: #0000FF;">FieldLinks</span>.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> SPFieldLink<span style="color: #000000;">&#40;</span>field<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;
                ct.<span style="color: #0000FF;">Update</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">true</span><span style="color: #000000;">&#41;</span>; <span style="color: #008080; font-style: italic;">// will update children</span>
            <span style="color: #000000;">&#125;</span>
        <span style="color: #000000;">&#125;</span></pre>
<p>As you can read from the above code the xml file would need to have a node like below for each lookup column:</p>
<pre class="xml">&nbsp;
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;Field</span>
         <span style="color: #000066;">Type</span>=<span style="color: #ff0000;">&quot;Lookup&quot;</span>
         <span style="color: #000066;">List</span>=<span style="color: #ff0000;">&quot;Access Type&quot;</span>
         <span style="color: #000066;">Name</span>=<span style="color: #ff0000;">&quot;AccessTypeColumn&quot;</span>
         <span style="color: #000066;">StaticName</span>=<span style="color: #ff0000;">&quot;Access_x0020_Type&quot;</span>
         <span style="color: #000066;">Group</span>=<span style="color: #ff0000;">&quot;Infrastructure&quot;</span>
         <span style="color: #000066;">ExistInContentTypes</span>=<span style="color: #ff0000;">&quot;THIS IS A COMMA DELIMITED LIST OF CONTENT NAMES&quot;</span>
         <span style="color: #000066;">LookUpField</span>=<span style="color: #ff0000;">&quot;Title&quot;</span>
         <span style="color: #000066;">Mult</span>=<span style="color: #ff0000;">&quot;TRUE&quot;</span>
         <span style="color: #000066;">Required</span>=<span style="color: #ff0000;">&quot;FALSE&quot;</span>
        <span style="font-weight: bold; color: black;">/&gt;</span></span>
&nbsp;</pre>
<h3>The Final Project</h3>
<p>So here are all the pieces of my infrastructure project. Notice the placement of the lookupfields xml file...this is because the layouts directory is setup as a virtual directory for every sharepoint site and we can read files from there without a permissions problem.</p>
<table>
<tr>
<td><em>12/TEMPLATES/FEATURES/myfeature/lists.xml</em></td>
<td>this contains the source lists for the lookup fields</td>
</tr>
<tr>
<td><em>12/TEMPLATES/FEATURES/myfeature/contenttypes.xml</em></td>
<td>this contains the content type definitions MINUS the lookup fields</td>
</tr>
<tr>
<td><em>12/TEMPLATES/FEATURES/myfeature/sitecolumns.xml</em></td>
<td>this contains all the other fields included in the content types</td>
</tr>
<tr>
<td><em>12/TEMPLATES/FEATURES/myfeature/feature.xml</em></td>
<td>the feature def</td>
</tr>
<tr>
<td><em>12/TEMPLATES/LAYOUTS/myfeature/lookupfields.xml</em></td>
<td>this contains all the lookup fields that need to be provisioned</td>
</tr>
</table>
<p>Hopefully this helps anyone who's been having problems getting this going.  And a big thanks to Waldek, Chris and Josh for their posts.</p>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/Configuration' rel='tag' target='_self'>Configuration</a>, <a class='technorati-link' href='http://technorati.com/tag/content+types' rel='tag' target='_self'>content types</a>, <a class='technorati-link' href='http://technorati.com/tag/Development' rel='tag' target='_self'>Development</a>, <a class='technorati-link' href='http://technorati.com/tag/lookup+fields' rel='tag' target='_self'>lookup fields</a>, <a class='technorati-link' href='http://technorati.com/tag/SharePoint' rel='tag' target='_self'>SharePoint</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://www.calvinirwin.net/2009/09/09/lookup-fields-and-content-types/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Custom Field Types&#8230;Building a base XML Field Type for SharePoint</title>
		<link>http://www.calvinirwin.net/2009/08/12/custom-field-types-seriously/</link>
		<comments>http://www.calvinirwin.net/2009/08/12/custom-field-types-seriously/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 23:47:10 +0000</pubDate>
		<dc:creator>Calvin</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[controls]]></category>
		<category><![CDATA[custom field type]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.calvinirwin.net/?p=124</guid>
		<description><![CDATA[Sometimes when I am working with SharePoint I really feel like I got it.  You now that feeling you get when you know exactly what you are doing and have no problems implementing it...then there are times when I really just want to smash something.  And it really doesn't matter what...it could be anything!  This [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes when I am working with SharePoint I really feel like I got it.  You now that feeling you get when you know exactly what you are doing and have no problems implementing it...then there are times when I really just want to smash something.  And it really doesn't matter what...it could be anything!  This is the feeling I got in the last couple of days working with custom field types in SharePoint.</p>
<p>It seems there are lots of blogs and articles out there talking about how to do it, but from what I could see (and to be fair I did not read them all so if you know of some good posts that would be great) it felt like most of the time I was only getting half the story.  I just finished putting together a very basic Custom Field Type that will display a multi line textbox in edit/new mode and simply display the value in a literal control in display mode.  In the grand scheme of things I am building a base XML Field Type to use for a series of additional Custom field types so essentially I want to store a string (yes I could use the XmlDocument)...but alas thats a story for another day.</p>
<p>So a bit of a primer, or rehash so I don't forget, when developing custom field types there are many pieces to it....not all of them required.  Here is a list of the items and what they do:</p>
<ul>
<li><strong>Field Type class </strong>- this class acts as the controller and hooks the rendering control, field type xml definition and the value class together.  It also provides validation at the field level via the GetValidatedString() method of the SPField object</li>
<li> <strong>Field Control class</strong> - this is the rendering engine and gives you the power to display your control in any manner you wish as well as perform validation on the data being saved via the UI.</li>
<li><strong>Field Value class</strong> - allows for custom logic to be put around mutiple column fields and different data structures that will be storing data for your field type.</li>
<li><strong>.ascx file in CONTROLTEMPLATES directory</strong> - this supplies rendering markup via a user control and hooks into the field control class</li>
<li><strong>fldtypes_*</strong> - this file that gets installed into the 12/TEMPLATES/XML directory and contains the information that SharePoint requires in order to load your field type into the system.  Such as the assembly to use, the parent type and other information.  This is required if the type is going to be applied to content types and become a field on a list.</li>
</ul>
<p>So for my requirements I only needed the field type, the field control and the fldtypes_xxx.xml file.  Lets look at the field type class I built</p>
<pre class="csharp"><span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> XmlFieldType : SPField
   <span style="color: #000000;">&#123;</span>
        <span style="color: #0600FF;">public</span> XmlFieldType<span style="color: #000000;">&#40;</span>SPFieldCollection fields, <span style="color: #FF0000;">string</span> fieldName<span style="color: #000000;">&#41;</span> : <span style="color: #0600FF;">base</span><span style="color: #000000;">&#40;</span>fields, fieldName<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span> <span style="color: #000000;">&#125;</span>
        <span style="color: #0600FF;">public</span> XmlFieldType<span style="color: #000000;">&#40;</span>SPFieldCollection fields, <span style="color: #FF0000;">string</span> fieldName, <span style="color: #FF0000;">string</span> displayName<span style="color: #000000;">&#41;</span> : <span style="color: #0600FF;">base</span><span style="color: #000000;">&#40;</span>fields, fieldName, displayName<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span> <span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">override</span> BaseFieldControl FieldRenderingControl
        <span style="color: #000000;">&#123;</span>
            get
            <span style="color: #000000;">&#123;</span>
                BaseFieldControl fldControl = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> XmlFieldControl<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
                fldControl.<span style="color: #0000FF;">FieldName</span> = InternalName;
                <span style="color: #0600FF;">return</span> fldControl;
            <span style="color: #000000;">&#125;</span>
        <span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">override</span> <span style="color: #FF0000;">object</span> GetFieldValue<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span> value<span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span>.<span style="color: #0000FF;">IsNullOrEmpty</span><span style="color: #000000;">&#40;</span>value<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
                <span style="color: #0600FF;">return</span> <span style="color: #0600FF;">null</span>;
            <span style="color: #0600FF;">return</span> value;
        <span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">override</span> Type FieldValueType
        <span style="color: #000000;">&#123;</span>
            get <span style="color: #000000;">&#123;</span> <span style="color: #0600FF;">return</span> <a href="http://www.google.com/search?q=typeof+msdn.microsoft.com"><span style="color: #008000;">typeof</span></a><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span><span style="color: #000000;">&#41;</span>; <span style="color: #000000;">&#125;</span>
        <span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">override</span> <span style="color: #FF0000;">string</span> DefaultValue
        <span style="color: #000000;">&#123;</span>
            get
            <span style="color: #000000;">&#123;</span>
                XmlDocument doc = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> XmlDocument<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
                doc.<span style="color: #0000FF;">LoadXml</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">SchemaXml</span><span style="color: #000000;">&#41;</span>;
                XmlNode nodeInFieldSchema = doc.<span style="color: #0000FF;">SelectSingleNode</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;Field/Default&quot;</span><span style="color: #000000;">&#41;</span>;
                <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>nodeInFieldSchema != <span style="color: #0600FF;">null</span><span style="color: #000000;">&#41;</span>
                    <span style="color: #0600FF;">return</span> nodeInFieldSchema.<span style="color: #0000FF;">InnerXml</span>;
                <span style="color: #0600FF;">return</span> <span style="color: #0600FF;">null</span>;
            <span style="color: #000000;">&#125;</span>
            set <span style="color: #000000;">&#123;</span> <span style="color: #0600FF;">base</span>.<span style="color: #0000FF;">DefaultValue</span> = value; <span style="color: #000000;">&#125;</span>
        <span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">override</span> <span style="color: #FF0000;">string</span> GetValidatedString<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">object</span> value<span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            <span style="color: #0600FF;">base</span>.<span style="color: #0000FF;">GetValidatedString</span><span style="color: #000000;">&#40;</span>value<span style="color: #000000;">&#41;</span>;
            <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>value == <span style="color: #0600FF;">null</span><span style="color: #000000;">&#41;</span>
            <span style="color: #000000;">&#123;</span>
                <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Required</span><span style="color: #000000;">&#41;</span> <span style="color: #0600FF;">throw</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> SPFieldValidationException<span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;Invalid value for required field.&quot;</span><span style="color: #000000;">&#41;</span>;
                <span style="color: #0600FF;">return</span> <span style="color: #FF0000;">string</span>.<span style="color: #0000FF;">Empty</span>;
            <span style="color: #000000;">&#125;</span>
            <span style="color: #0600FF;">else</span>
            <span style="color: #000000;">&#123;</span>
                <span style="color: #0600FF;">return</span> value.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
            <span style="color: #000000;">&#125;</span>
        <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre>
<p>Lets review</p>
<ul>
<li>The two constructors are required...don't even bother</li>
<li><strong>FieldRenderingControl()</strong> method tells the field type which control to use</li>
<li><strong>GetFieldValue()</strong> method returns the value of the field....if we were using a custom type you would cast that to the appropriate type here</li>
<li><strong>FieldValueType()</strong> - get the type of the Value class</li>
<li><strong>DefautValue()</strong> - this gets the default value from the field if one is defined</li>
<li><strong>GetValidatedString()</strong> - perform field level validation</li>
</ul>
<p>The Field Control Class is fairly simple as well:</p>
<pre class="csharp"><span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> XmlFieldControl : BaseFieldControl
<span style="color: #000000;">&#123;</span>
        <span style="color: #0600FF;">protected</span> Literal _values;
        <span style="color: #0600FF;">protected</span> TextBox _editor;
&nbsp;
        <span style="color: #0600FF;">protected</span> <span style="color: #0600FF;">override</span> <span style="color: #0600FF;">void</span> OnInit<span style="color: #000000;">&#40;</span>EventArgs e<span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            <span style="color: #0600FF;">base</span>.<span style="color: #0000FF;">OnInit</span><span style="color: #000000;">&#40;</span>e<span style="color: #000000;">&#41;</span>;
            EnsureChildControls<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
        <span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #0600FF;">protected</span> <span style="color: #0600FF;">override</span> <span style="color: #0600FF;">void</span> CreateChildControls<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
&nbsp;
            <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Field</span> == <span style="color: #0600FF;">null</span> || <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">ControlMode</span> == SPControlMode.<span style="color: #0000FF;">Invalid</span><span style="color: #000000;">&#41;</span>
                <span style="color: #0600FF;">return</span>;
&nbsp;
            Controls.<span style="color: #0000FF;">Clear</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
            <span style="color: #0600FF;">base</span>.<span style="color: #0000FF;">CreateChildControls</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
            _editor = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> TextBox<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
            _editor.<span style="color: #0000FF;">TextMode</span> = TextBoxMode.<span style="color: #0000FF;">MultiLine</span>;
            _editor.<span style="color: #0000FF;">Height</span> = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Unit<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">300</span><span style="color: #000000;">&#41;</span>;
            _editor.<span style="color: #0000FF;">Width</span> = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Unit<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">500</span><span style="color: #000000;">&#41;</span>;
            Controls.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span>_editor<span style="color: #000000;">&#41;</span>;
&nbsp;
            <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>ControlMode == SPControlMode.<span style="color: #0000FF;">Display</span><span style="color: #000000;">&#41;</span>
            <span style="color: #000000;">&#123;</span>
                _values = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Literal<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
                _values.<span style="color: #0000FF;">Text</span> = Convert.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span>ItemFieldValue<span style="color: #000000;">&#41;</span>;
                Controls.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span>_values<span style="color: #000000;">&#41;</span>;
            <span style="color: #000000;">&#125;</span>
        <span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #0600FF;">protected</span> <span style="color: #0600FF;">override</span> <span style="color: #0600FF;">void</span> Render<span style="color: #000000;">&#40;</span>HtmlTextWriter output<span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
&nbsp;
            EnsureChildControls<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
            <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>ControlMode == SPControlMode.<span style="color: #0000FF;">Display</span><span style="color: #000000;">&#41;</span>
            <span style="color: #000000;">&#123;</span>
                <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>_values != <span style="color: #0600FF;">null</span><span style="color: #000000;">&#41;</span>
                    _values.<span style="color: #0000FF;">RenderControl</span><span style="color: #000000;">&#40;</span>output<span style="color: #000000;">&#41;</span>;
            <span style="color: #000000;">&#125;</span>
            <span style="color: #0600FF;">else</span>
            <span style="color: #000000;">&#123;</span>
                <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>_editor != <span style="color: #0600FF;">null</span><span style="color: #000000;">&#41;</span>
                    _editor.<span style="color: #0000FF;">RenderControl</span><span style="color: #000000;">&#40;</span>output<span style="color: #000000;">&#41;</span>;
            <span style="color: #000000;">&#125;</span>
        <span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">virtual</span> <span style="color: #FF0000;">string</span> Text
        <span style="color: #000000;">&#123;</span>
            get
            <span style="color: #000000;">&#123;</span>
                <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">EnsureChildControls</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
                <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #0600FF;">this</span>._editor == <span style="color: #0600FF;">null</span><span style="color: #000000;">&#41;</span>
                <span style="color: #000000;">&#123;</span>
                    <span style="color: #0600FF;">return</span> <span style="color: #0600FF;">null</span>;
                <span style="color: #000000;">&#125;</span>
                <span style="color: #0600FF;">return</span> <span style="color: #0600FF;">this</span>._editor.<span style="color: #0000FF;">Text</span>;
            <span style="color: #000000;">&#125;</span>
&nbsp;
            set
            <span style="color: #000000;">&#123;</span>
                <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">EnsureChildControls</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
                <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #0600FF;">this</span>._editor != <span style="color: #0600FF;">null</span><span style="color: #000000;">&#41;</span>
                <span style="color: #000000;">&#123;</span>
                    <span style="color: #0600FF;">this</span>._editor.<span style="color: #0000FF;">Text</span> = value;
                <span style="color: #000000;">&#125;</span>
            <span style="color: #000000;">&#125;</span>
        <span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">override</span> <span style="color: #FF0000;">object</span> Value
        <span style="color: #000000;">&#123;</span>
            get
            <span style="color: #000000;">&#123;</span> <span style="color: #0600FF;">return</span> <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Text</span>; <span style="color: #000000;">&#125;</span>
            set
            <span style="color: #000000;">&#123;</span>
                <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #0600FF;">base</span>.<span style="color: #0000FF;">Field</span> != <span style="color: #0600FF;">null</span><span style="color: #000000;">&#41;</span>
                <span style="color: #000000;">&#123;</span>
                    <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Text</span> = <span style="color: #0600FF;">base</span>.<span style="color: #0000FF;">Field</span>.<span style="color: #0000FF;">GetFieldValueForEdit</span><span style="color: #000000;">&#40;</span>value<span style="color: #000000;">&#41;</span>;
                    <span style="color: #0600FF;">base</span>.<span style="color: #0000FF;">Value</span> = <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span><span style="color: #000000;">&#41;</span>value;
                    <span style="color: #0600FF;">base</span>.<span style="color: #0000FF;">UpdateFieldValueInItem</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
                <span style="color: #000000;">&#125;</span>
            <span style="color: #000000;">&#125;</span>
        <span style="color: #000000;">&#125;</span>
    <span style="color: #000000;">&#125;</span></pre>
<p>Lets take a look at what this class is doing:</p>
<ul>
<li><strong>OnInit()</strong> - come on, do I have to explain?</li>
<li><strong>CreateChildControls() </strong>- initialize your controls and add to the Controls collection</li>
<li><strong>Render()</strong> - writes the controls to the HtmlTextWriter</li>
<li><strong>Text</strong> - This sets/gets the value in the controls</li>
<li><strong>Value</strong> - this sets the value in the Text property and notice the <strong>base.UpdateFieldValueInItem();</strong> statement...this oushes the value from Value to ItemFieldValue and allows you to access this value in display mode because Value returns null (which i did not find the documentation on M$ thank you very much).</li>
</ul>
<p>So that leaves the last piece of the pie for my simple implementation the fldtypes file:</p>
<pre class="xml"><span style="color: #ddbb00;">&amp;lt;</span>FieldTypes<span style="color: #ddbb00;">&amp;gt;</span>
<span style="color: #ddbb00;">&amp;lt;</span>FieldType<span style="color: #ddbb00;">&amp;gt;</span>
<span style="color: #ddbb00;">&amp;lt;</span>Field Name=&quot;TypeName&quot;<span style="color: #ddbb00;">&amp;gt;</span>XmlFieldType<span style="color: #ddbb00;">&amp;lt;</span>/Field<span style="color: #ddbb00;">&amp;gt;</span>
<span style="color: #ddbb00;">&amp;lt;</span>Field Name=&quot;ParentType&quot;<span style="color: #ddbb00;">&amp;gt;</span><span style="color: #ddbb00;">&amp;lt;</span>/Field<span style="color: #ddbb00;">&amp;gt;</span>
<span style="color: #ddbb00;">&amp;lt;</span>Field Name=&quot;InternalType&quot;<span style="color: #ddbb00;">&amp;gt;</span>Note<span style="color: #ddbb00;">&amp;lt;</span>/Field<span style="color: #ddbb00;">&amp;gt;</span>
<span style="color: #ddbb00;">&amp;lt;</span>Field Name=&quot;SQLType&quot;<span style="color: #ddbb00;">&amp;gt;</span>ntext<span style="color: #ddbb00;">&amp;lt;</span>/Field<span style="color: #ddbb00;">&amp;gt;</span>
<span style="color: #ddbb00;">&amp;lt;</span>Field Name=&quot;TypeDisplayName&quot;<span style="color: #ddbb00;">&amp;gt;</span>Xml Field<span style="color: #ddbb00;">&amp;lt;</span>/Field<span style="color: #ddbb00;">&amp;gt;</span>
<span style="color: #ddbb00;">&amp;lt;</span>Field Name=&quot;TypeShortDescription&quot;<span style="color: #ddbb00;">&amp;gt;</span>Xml controls<span style="color: #ddbb00;">&amp;lt;</span>/Field<span style="color: #ddbb00;">&amp;gt;</span>
<span style="color: #ddbb00;">&amp;lt;</span>Field Name=&quot;UserCreatable&quot;<span style="color: #ddbb00;">&amp;gt;</span>TRUE<span style="color: #ddbb00;">&amp;lt;</span>/Field<span style="color: #ddbb00;">&amp;gt;</span>
<span style="color: #ddbb00;">&amp;lt;</span>Field Name=&quot;ShowOnListCreate&quot;<span style="color: #ddbb00;">&amp;gt;</span>TRUE<span style="color: #ddbb00;">&amp;lt;</span>/Field<span style="color: #ddbb00;">&amp;gt;</span>
<span style="color: #ddbb00;">&amp;lt;</span>Field Name=&quot;Sortable&quot;<span style="color: #ddbb00;">&amp;gt;</span>FALSE<span style="color: #ddbb00;">&amp;lt;</span>/Field<span style="color: #ddbb00;">&amp;gt;</span>
<span style="color: #ddbb00;">&amp;lt;</span>Field Name=&quot;AllowBaseTypeRendering&quot;<span style="color: #ddbb00;">&amp;gt;</span>FALSE<span style="color: #ddbb00;">&amp;lt;</span>/Field<span style="color: #ddbb00;">&amp;gt;</span>
<span style="color: #ddbb00;">&amp;lt;</span>Field Name=&quot;Filterable&quot;<span style="color: #ddbb00;">&amp;gt;</span>FALSE<span style="color: #ddbb00;">&amp;lt;</span>/Field<span style="color: #ddbb00;">&amp;gt;</span>
<span style="color: #ddbb00;">&amp;lt;</span>Field Name=&quot;FieldTypeClass&quot;<span style="color: #ddbb00;">&amp;gt;</span>Website.CustomFields.XmlFieldType, Website.CustomFields, Version=1.0.0.0, Culture=neutral, PublicKeyToken=346fcdd567259ee6<span style="color: #ddbb00;">&amp;lt;</span>/Field<span style="color: #ddbb00;">&amp;gt;</span>
<span style="color: #ddbb00;">&amp;lt;</span>RenderPattern Name=&quot;HeaderPattern&quot;<span style="color: #ddbb00;">&amp;gt;</span>
<span style="color: #ddbb00;">&amp;lt;</span>Property Select=&quot;DisplayName&quot; HTMLEncode=&quot;TRUE&quot;/<span style="color: #ddbb00;">&amp;gt;</span>
<span style="color: #ddbb00;">&amp;lt;</span>/RenderPattern<span style="color: #ddbb00;">&amp;gt;</span>
<span style="color: #ddbb00;">&amp;lt;</span>RenderPattern Name=&quot;DisplayPattern&quot;<span style="color: #ddbb00;">&amp;gt;</span>
<span style="color: #ddbb00;">&amp;lt;</span>Column/<span style="color: #ddbb00;">&amp;gt;</span>
<span style="color: #ddbb00;">&amp;lt;</span>/RenderPattern<span style="color: #ddbb00;">&amp;gt;</span>
<span style="color: #ddbb00;">&amp;lt;</span>/FieldType<span style="color: #ddbb00;">&amp;gt;</span>
<span style="color: #ddbb00;">&amp;lt;</span>/FieldTypes<span style="color: #ddbb00;">&amp;gt;</span></pre>
<p>So there you have it.  All I need to do in order to inherit from this is to remove the rendering (which i dont need anyway  as this is going to be a base type) and it should be good to go.  Those three pieces of code can be installed into your SharePoint environment and should help you get started to understanding custom field types.</p>
<p><span style="color: #800000;"><em>Don't forget to add the SafeControl entry, Adjust your trust level and move the .dll into your bin folder as well.</em></span></p>
<p><a href="/files/FieldType.zip">Download the code here</a></p>
<p>Resources I found useful:</p>
<ul>
<li>I did work through the example in <a href="http://www.andrewconnell.com/blog/">Andrew Connell</a>'s book (Professional SP 2007 WCM development) and that worked fine and he actually does a great job of explaining most of whats going on here.</li>
<li><a href="http://msdn.microsoft.com/en-us/library/ms446361.aspx">MSDN</a>...where else</li>
<li><a href="http://www.chaholl.com/archive/2009/07/18/custom-fieldtypes-ndash-part-1.aspx">Charlie Holland </a>has a pretty good article series on this stuff but unfortunately I couldn't get it working.  I also wanted a simple bare bones implementation.</li>
</ul>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 2968px; width: 1px; height: 1px;">Sometimes when I am working with SharePoint I really feel like I got it.  You now that feeling you get when you know exactly what you are doing and have no problems implementing it...then there are times when I really just want to smash something.  And it really doesn't matter what...it could be anything!  This is the feeling I got in the last couple of days working with custom field types in SharePoint.  It seems there are lots of blogs and articles out there talking about how to do it, but from what I could see (and to be fair I did not read them all so if you know of some good posts that would be great) it felt like most of the time I was only getting half the story.  I just finished putting together a very basic Custom Field Type that will display a multiline textbox in edit/new mode and simply display the value in a literal control in display mode.  In the grand scheme of things I am building a base XML Field Type to use for a series of additional Custom field types so essentially I want to store a string (yes I could use the XmlDocument)...but alas thats a story for another day.</p>
<p>So a bit of a primer, or rehash so I don't forget, when developing custom field types there are many pieces to it....not all of them required.  Here is a lit of the items and what they do:</p>
<p>* Field Type class - this class acts as the controller and hooks the rendering control, field type xml definition and the value class together.  It also provides validation at the field level via the GetValidatedString() method of the SPField object<br />
* Field Control class - this is the rendering engine and gives you the power to display your control in any manner you wish as well as perform validation on the data being saved via the UI.<br />
* Field Value class - allows for custom logic to be put around mutiple column fields and different data structures that will be storing data for your field type.<br />
* .ascx file in CONTROLTEMPALTES directory - this supplies rendering markup via a usercontrol and hooks into the field control class<br />
* fldtypes_* - this file that gets installed into the 12/TEMPLATES/XML directory and contrains the information that SharePoint requires in order to load your field type into the system.  Such as the assembly to use, the parent type and other information.  This is required if the type is going to be applied to content types and become a field on a list.</p>
<p>So for my requirements I only needed the field type, the field control and the fldtypes_xxx.xml file.  Lets look at the field type class I built</p>
<pre class="csharp"><span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> XmlFieldType : SPField
<span style="color: #000000;">&#123;</span>
<span style="color: #0600FF;">public</span> XmlFieldType<span style="color: #000000;">&#40;</span>SPFieldCollection fields, <span style="color: #FF0000;">string</span> fieldName<span style="color: #000000;">&#41;</span> : <span style="color: #0600FF;">base</span><span style="color: #000000;">&#40;</span>fields, fieldName<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span> <span style="color: #000000;">&#125;</span>
<span style="color: #0600FF;">public</span> XmlFieldType<span style="color: #000000;">&#40;</span>SPFieldCollection fields, <span style="color: #FF0000;">string</span> fieldName, <span style="color: #FF0000;">string</span> displayName<span style="color: #000000;">&#41;</span> : <span style="color: #0600FF;">base</span><span style="color: #000000;">&#40;</span>fields, fieldName, displayName<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span> <span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0600FF;">public</span> <span style="color: #0600FF;">override</span> BaseFieldControl FieldRenderingControl
<span style="color: #000000;">&#123;</span>
get
<span style="color: #000000;">&#123;</span>
BaseFieldControl fldControl = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> XmlFieldControl<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
fldControl.<span style="color: #0000FF;">FieldName</span> = InternalName;
<span style="color: #0600FF;">return</span> fldControl;
<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0600FF;">public</span> <span style="color: #0600FF;">override</span> <span style="color: #FF0000;">object</span> GetFieldValue<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span> value<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span>.<span style="color: #0000FF;">IsNullOrEmpty</span><span style="color: #000000;">&#40;</span>value<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
<span style="color: #0600FF;">return</span> <span style="color: #0600FF;">null</span>;
<span style="color: #0600FF;">return</span> value;
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0600FF;">public</span> <span style="color: #0600FF;">override</span> Type FieldValueType
<span style="color: #000000;">&#123;</span>
get <span style="color: #000000;">&#123;</span> <span style="color: #0600FF;">return</span> <a href="http://www.google.com/search?q=typeof+msdn.microsoft.com"><span style="color: #008000;">typeof</span></a><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span><span style="color: #000000;">&#41;</span>; <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0600FF;">public</span> <span style="color: #0600FF;">override</span> <span style="color: #FF0000;">string</span> DefaultValue
<span style="color: #000000;">&#123;</span>
get
<span style="color: #000000;">&#123;</span>
XmlDocument doc = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> XmlDocument<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
doc.<span style="color: #0000FF;">LoadXml</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">SchemaXml</span><span style="color: #000000;">&#41;</span>;
XmlNode nodeInFieldSchema = doc.<span style="color: #0000FF;">SelectSingleNode</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;Field/Default&quot;</span><span style="color: #000000;">&#41;</span>;
<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>nodeInFieldSchema != <span style="color: #0600FF;">null</span><span style="color: #000000;">&#41;</span>
<span style="color: #0600FF;">return</span> nodeInFieldSchema.<span style="color: #0000FF;">InnerXml</span>;
<span style="color: #0600FF;">return</span> <span style="color: #0600FF;">null</span>;
<span style="color: #000000;">&#125;</span>
set <span style="color: #000000;">&#123;</span> <span style="color: #0600FF;">base</span>.<span style="color: #0000FF;">DefaultValue</span> = value; <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0600FF;">public</span> <span style="color: #0600FF;">override</span> <span style="color: #FF0000;">string</span> GetValidatedString<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">object</span> value<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #0600FF;">base</span>.<span style="color: #0000FF;">GetValidatedString</span><span style="color: #000000;">&#40;</span>value<span style="color: #000000;">&#41;</span>;
<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>value == <span style="color: #0600FF;">null</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Required</span><span style="color: #000000;">&#41;</span> <span style="color: #0600FF;">throw</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> SPFieldValidationException<span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;Invalid value for required field.&quot;</span><span style="color: #000000;">&#41;</span>;
<span style="color: #0600FF;">return</span> <span style="color: #FF0000;">string</span>.<span style="color: #0000FF;">Empty</span>;
<span style="color: #000000;">&#125;</span>
<span style="color: #0600FF;">else</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #0600FF;">return</span> value.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre>
<p>Lets review</p>
<p>* The two constructors are required<br />
* FieldRenderingControl() method tells the field type which control to use<br />
* GetFieldValue() method returns the value of the field....if we were using a custom type you would cast that to the appropriate type here<br />
* FieldValueType() - get the type of the Value class<br />
* DefautValue() - this gets the default value from the field if one is defined<br />
* GetValidatedString() - perform field level validation</p>
<p>The Field Control Class is fairly simple as well:</p>
<pre class="csharp"><span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> XmlFieldControl : BaseFieldControl
<span style="color: #000000;">&#123;</span>
<span style="color: #0600FF;">protected</span> Literal _values;
<span style="color: #0600FF;">protected</span> TextBox _editor;
&nbsp;
<span style="color: #0600FF;">protected</span> <span style="color: #0600FF;">override</span> <span style="color: #0600FF;">void</span> OnInit<span style="color: #000000;">&#40;</span>EventArgs e<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #0600FF;">base</span>.<span style="color: #0000FF;">OnInit</span><span style="color: #000000;">&#40;</span>e<span style="color: #000000;">&#41;</span>;
EnsureChildControls<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0600FF;">protected</span> <span style="color: #0600FF;">override</span> <span style="color: #0600FF;">void</span> CreateChildControls<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
&nbsp;
<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Field</span> == <span style="color: #0600FF;">null</span> || <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">ControlMode</span> == SPControlMode.<span style="color: #0000FF;">Invalid</span><span style="color: #000000;">&#41;</span>
<span style="color: #0600FF;">return</span>;
&nbsp;
Controls.<span style="color: #0000FF;">Clear</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
<span style="color: #0600FF;">base</span>.<span style="color: #0000FF;">CreateChildControls</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
_editor = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> TextBox<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
_editor.<span style="color: #0000FF;">TextMode</span> = TextBoxMode.<span style="color: #0000FF;">MultiLine</span>;
_editor.<span style="color: #0000FF;">Height</span> = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Unit<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">300</span><span style="color: #000000;">&#41;</span>;
_editor.<span style="color: #0000FF;">Width</span> = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Unit<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">500</span><span style="color: #000000;">&#41;</span>;
Controls.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span>_editor<span style="color: #000000;">&#41;</span>;
&nbsp;
<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>ControlMode == SPControlMode.<span style="color: #0000FF;">Display</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
_values = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Literal<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
_values.<span style="color: #0000FF;">Text</span> = Convert.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span>ItemFieldValue<span style="color: #000000;">&#41;</span>;
Controls.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span>_values<span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0600FF;">protected</span> <span style="color: #0600FF;">override</span> <span style="color: #0600FF;">void</span> Render<span style="color: #000000;">&#40;</span>HtmlTextWriter output<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
&nbsp;
EnsureChildControls<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>ControlMode == SPControlMode.<span style="color: #0000FF;">Display</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>_values != <span style="color: #0600FF;">null</span><span style="color: #000000;">&#41;</span>
_values.<span style="color: #0000FF;">RenderControl</span><span style="color: #000000;">&#40;</span>output<span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span>
<span style="color: #0600FF;">else</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>_editor != <span style="color: #0600FF;">null</span><span style="color: #000000;">&#41;</span>
_editor.<span style="color: #0000FF;">RenderControl</span><span style="color: #000000;">&#40;</span>output<span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0600FF;">public</span> <span style="color: #0600FF;">virtual</span> <span style="color: #FF0000;">string</span> Text
<span style="color: #000000;">&#123;</span>
get
<span style="color: #000000;">&#123;</span>
<span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">EnsureChildControls</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #0600FF;">this</span>._editor == <span style="color: #0600FF;">null</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #0600FF;">return</span> <span style="color: #0600FF;">null</span>;
<span style="color: #000000;">&#125;</span>
<span style="color: #0600FF;">return</span> <span style="color: #0600FF;">this</span>._editor.<span style="color: #0000FF;">Text</span>;
<span style="color: #000000;">&#125;</span>
&nbsp;
set
<span style="color: #000000;">&#123;</span>
<span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">EnsureChildControls</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #0600FF;">this</span>._editor != <span style="color: #0600FF;">null</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #0600FF;">this</span>._editor.<span style="color: #0000FF;">Text</span> = value;
<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0600FF;">public</span> <span style="color: #0600FF;">override</span> <span style="color: #FF0000;">object</span> Value
<span style="color: #000000;">&#123;</span>
get
<span style="color: #000000;">&#123;</span> <span style="color: #0600FF;">return</span> <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Text</span>; <span style="color: #000000;">&#125;</span>
set
<span style="color: #000000;">&#123;</span>
<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #0600FF;">base</span>.<span style="color: #0000FF;">Field</span> != <span style="color: #0600FF;">null</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Text</span> = <span style="color: #0600FF;">base</span>.<span style="color: #0000FF;">Field</span>.<span style="color: #0000FF;">GetFieldValueForEdit</span><span style="color: #000000;">&#40;</span>value<span style="color: #000000;">&#41;</span>;
<span style="color: #0600FF;">base</span>.<span style="color: #0000FF;">Value</span> = <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span><span style="color: #000000;">&#41;</span>value;
<span style="color: #0600FF;">base</span>.<span style="color: #0000FF;">UpdateFieldValueInItem</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre>
<p>sdfsdf</p>
<pre class="xml">    XmlFieldType
&nbsp;
    Note
    ntext
    Xml Field
    Xml controls
    TRUE
    TRUE
    FALSE
    FALSE
    FALSE
    Website.CustomFields.XmlFieldType, Website.CustomFields, Version=1.0.0.0, Culture=neutral, PublicKeyToken=346fcdd567259ee6</pre>
<p>I did work through the example in Andrew Connell's book (Professional SP 2007 WCM development) and that worked fine and he actually does a great job of explaining most of whats going on here.</p>
<p>http://msdn.microsoft.com/en-us/library/ms446361.aspx</p></div>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/controls' rel='tag' target='_self'>controls</a>, <a class='technorati-link' href='http://technorati.com/tag/custom+field+type' rel='tag' target='_self'>custom field type</a>, <a class='technorati-link' href='http://technorati.com/tag/Development' rel='tag' target='_self'>Development</a>, <a class='technorati-link' href='http://technorati.com/tag/SharePoint' rel='tag' target='_self'>SharePoint</a>, <a class='technorati-link' href='http://technorati.com/tag/xml' rel='tag' target='_self'>xml</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://www.calvinirwin.net/2009/08/12/custom-field-types-seriously/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SPException: SharePoint cannot find the user &#8211; SharePoint SPWeb.EnsureUser() and a Custom MembershipProvider</title>
		<link>http://www.calvinirwin.net/2009/08/05/sharepoint-spweb-ensureuser-and-thecustom-membership-provider/</link>
		<comments>http://www.calvinirwin.net/2009/08/05/sharepoint-spweb-ensureuser-and-thecustom-membership-provider/#comments</comments>
		<pubDate>Wed, 05 Aug 2009 22:22:28 +0000</pubDate>
		<dc:creator>Calvin</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[IIS]]></category>
		<category><![CDATA[MembershipProvider]]></category>
		<category><![CDATA[SharePoint]]></category>

		<guid isPermaLink="false">http://www.calvinirwin.net/?p=90</guid>
		<description><![CDATA[Its seems that SharePoint has a knack for surprising me with seriously strange errors sometimes.  Usually at the core of the error there is a sound explanation as to why this is happening but nonetheless I am not pleased with the obscurity of them sometimes.  Case in point, while working on a Console [...]]]></description>
			<content:encoded><![CDATA[<p>Its seems that SharePoint has a knack for surprising me with seriously strange errors sometimes.  Usually at the core of the error there is a sound explanation as to why this is happening but nonetheless I am not pleased with the obscurity of them sometimes.  Case in point, while working on a Console application that would load FBA (Forms Based Authentication) users into a sharepoint sie collection and then create a site for each one (granting permissions and so on) I came across a very strange error - <strong>SPException: SharePoint cannot find the user.</strong></p>
<p>This kind of surprised me at first and I was wondering if somehow my <strong>CustomMembershipProvider</strong> setup stopped working on my portal site, but that was fine. So after hammering away at it for a while I came across a <a href="http://blog.mastykarz.nl/inconvenient-programmatically-sharepoint-users-spweb-ensureuser/">great article written by Waldek Mastykarz</a> on this exact problem.  After reading through his investigation it makes sense why it doesn't work in a console application but it works under the context of a SharePoint website. Essentially the web application has access to a context object and this has access to the providers node in your web.config file,  BUT the console application does not have this information available.  So when the SharePoint assemblies attempt to access this information they cannot because it does not exist.</p>
<p>The way around this is to create an HttpContext in your application before attempting to run <code>SPWeb.EnsureUser("blah")</code> like so:</p>
<pre>
<div class="code">
if (HttpContext.Current == null)
{
     HttpRequest request = new HttpRequest("", web.Url, "");
     HttpContext.Current = new HttpContext(request,
     new HttpResponse(new StringWriter()));
     HttpContext.Current.Items["HttpHandlerSPWeb"] = web;
}</div>
</pre>
<p>Then add the system.web/membership/providers node to your app.config file (which you may have to create in the project)..  Mine looks like so:</p>
<pre>
<div class="code">&lt;system.web&gt;
     &lt;membership&gt;
          &lt;providers&gt;
          &lt;add name="CustomSqlProvider" applicationName="/Portal"
            connectionStringName="sqlData"
            type="CustomProviders.CustomSqlMembershipProvider,
            CustomProviders, Version=1.0.0.0, Culture=neutral,
            PublicKeyToken=91a4fcd60b73a0e8" /&gt;
          &lt;/providers&gt;
     &lt;/membership&gt;
&lt;/system.web&gt;
&lt;connectionStrings&gt;
     &lt;add name="sqlData" connectionString="Data Source=sqlpd;
       Initial Catalog=PUsers; Integrated Security=True;
       MultipleActiveResultSets=True "
       providerName="System.Data.SqlClient" /&gt;
&lt;/connectionStrings&gt;</div>
</pre>
<p>After adding this information and running a few tests it started to work.  In fact it worked really well on my dev box...the only problem was it was a little intermittent on my production machine.  Which is funny because the provider on the site itself works just fine all the time but in order to get my console application working (the EnsureUser() portion) the site would require an IIS reset.  This is the one MAJOR stumbling block that I have yet to overcome...the only saving grace I have is that I can import the users manually into the system first using the UI and then run my console application that will load the sites and grant permissions to sites based on an external configuration file.</p>
<p>Many thanks to <a href="http://blog.mastykarz.nl"><cite>Waldek Mastykarz</cite></a> for all his help on this one so far...I know I will be coming back to this one in the near future but my head hurts a little and I need a beer.</p>
<p>Canadian SharePint event anyone?</p>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/Development' rel='tag' target='_self'>Development</a>, <a class='technorati-link' href='http://technorati.com/tag/IIS' rel='tag' target='_self'>IIS</a>, <a class='technorati-link' href='http://technorati.com/tag/MembershipProvider' rel='tag' target='_self'>MembershipProvider</a>, <a class='technorati-link' href='http://technorati.com/tag/Security' rel='tag' target='_self'>Security</a>, <a class='technorati-link' href='http://technorati.com/tag/SharePoint' rel='tag' target='_self'>SharePoint</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://www.calvinirwin.net/2009/08/05/sharepoint-spweb-ensureuser-and-thecustom-membership-provider/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SharePoint Permissions</title>
		<link>http://www.calvinirwin.net/2009/07/29/sharepoint-permissions/</link>
		<comments>http://www.calvinirwin.net/2009/07/29/sharepoint-permissions/#comments</comments>
		<pubDate>Wed, 29 Jul 2009 20:00:32 +0000</pubDate>
		<dc:creator>Calvin</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint Designer]]></category>
		<category><![CDATA[web parts]]></category>

		<guid isPermaLink="false">http://www.calvinirwin.net/?p=65</guid>
		<description><![CDATA[Inside the Microsoft.SharePoint namespace there is the SPBasePermissions enumeration.  It specifies the built-in permissions available in Windows SharePoint Services / MOSS 2007.  This was taken from the MSDN site, but I am posting it here because sometimes they move content around and I can't find it...ha ha you can't fool me Microsoft!!!
Using the enumerations [...]]]></description>
			<content:encoded><![CDATA[<p>Inside the Microsoft.SharePoint namespace there is the SPBasePermissions enumeration.  It specifies the built-in permissions available in Windows SharePoint Services / MOSS 2007.  This was taken from the MSDN site, but I am posting it here because sometimes they move content around and I can't find it...ha ha you can't fool me Microsoft!!!</p>
<p>Using the enumerations below you can wrap some markup on your page in an SPSecurityTrimmedControl like so: </p>
<div style="padding-left:15px; padding-top: 10px;  padding-bottom: 10px; font-family: courier new; color: #000099;">
&lt;Sharepoint:SPSecurityTrimmedControl runat="server" PermissionsString="CreateGroups"&gt;</div>
<p>and only allow users with the defined permission to see the contents of the security trimming control.</p>
<table border="1">
<tbody>
<tr style="background-color:#3366CC;">
<th style="color: white;">Member name</th>
<th style="color: white;">Description</th>
</tr>
<tr>
<td><strong>AddAndCustomizePages</strong></td>
<td>Add, change, or delete HTML pages or Web Part Pages, and edit the Web site using a Windows SharePoint Services–compatible editor.</td>
</tr>
<tr>
<td><strong>AddDelPrivateWebParts</strong></td>
<td>Add or remove personal Web Parts on a Web Part Page.</td>
</tr>
<tr>
<td><strong>AddListItems</strong></td>
<td>Add items to lists, add documents to document libraries, and add Web discussion comments.</td>
</tr>
<tr>
<td><strong>ApplyStyleSheets</strong></td>
<td>Apply a style sheet (.css file) to the Web site.</td>
</tr>
<tr>
<td><strong>ApplyThemeAndBorder</strong></td>
<td>Apply a theme or borders to the entire Web site.</td>
</tr>
<tr>
<td><strong>ApproveItems</strong></td>
<td>Approve a minor version of a list item or document.</td>
</tr>
<tr>
<td><strong>BrowseDirectories</strong></td>
<td>Enumerate files and folders in a Web site using Microsoft Office SharePoint Designer 2007 and WebDAV interfaces.</td>
</tr>
<tr>
<td><strong>BrowseUserInfo</strong></td>
<td>View information about users of the Web site.</td>
</tr>
<tr>
<td><strong>CancelCheckout</strong></td>
<td>Discard or check in a document which is checked out to another user.</td>
</tr>
<tr>
<td><strong>CreateAlerts</strong></td>
<td>Create e-mail alerts.</td>
</tr>
<tr>
<td><strong>CreateGroups</strong></td>
<td>Create a group of users that can be used anywhere within the site collection.</td>
</tr>
<tr>
<td><strong>CreateSSCSite</strong></td>
<td>Create a Web site using Self-Service Site Creation.</td>
</tr>
<tr>
<td><strong>DeleteListItems</strong></td>
<td>Delete items from a list, documents from a document library, and Web discussion comments in documents.</td>
</tr>
<tr>
<td><strong>DeleteVersions</strong></td>
<td>Delete past versions of a list item or document.</td>
</tr>
<tr>
<td><strong>EditListItems</strong></td>
<td>Edit items in lists, edit documents in document libraries, edit Web discussion comments in documents, and customize Web Part Pages in document libraries.</td>
</tr>
<tr>
<td><strong>EditMyUserInfo</strong></td>
<td>Allows a user to change his or her user information, such as adding a picture.</td>
</tr>
<tr>
<td><strong>EmptyMask</strong></td>
<td>Has no permissions on the Web site. Not available through the user interface.</td>
</tr>
<tr>
<td><strong>EnumeratePermissions</strong></td>
<td>Enumerate permissions on the Web site, list, folder, document, or list item.</td>
</tr>
<tr>
<td><strong>FullMask</strong></td>
<td>Has all permissions on the Web site. Not available through the user interface.</td>
</tr>
<tr>
<td><strong>ManageAlerts</strong></td>
<td>Manage alerts for all users of the Web site.</td>
</tr>
<tr>
<td><strong>ManageLists</strong></td>
<td>Create and delete lists, add or remove columns in a list, and add or remove public views of a list.</td>
</tr>
<tr>
<td><strong>ManagePermissions</strong></td>
<td>Create and change permission levels on the Web site and assign permissions to users and groups.</td>
</tr>
<tr>
<td><strong>ManagePersonalViews</strong></td>
<td>Create, change, and delete personal views of lists.</td>
</tr>
<tr>
<td><strong>ManageSubwebs</strong></td>
<td>Create subsites such as team sites, Meeting Workspace sites, and Document Workspace sites.</td>
</tr>
<tr>
<td><strong>ManageWeb</strong></td>
<td>Grant the ability to perform all administration tasks for the Web site as well as manage content. Activate, deactivate, or edit properties of Web site scoped Features through the object model or through the user interface (UI). When granted on the root Web site of a site collection, activate, deactivate, or edit properties of site collection scoped Features through the object model. To browse to the <strong>Site Collection Features</strong> page and activate or deactivate site collection scoped Features through the UI, you must be a site collection administrator.</td>
</tr>
<tr>
<td><strong>Open</strong></td>
<td>Allow users to open a Web site, list, or folder to access items inside that container.</td>
</tr>
<tr>
<td><strong>OpenItems</strong></td>
<td>View the source of documents with server-side file handlers.</td>
</tr>
<tr>
<td><strong>UpdatePersonalWebParts</strong></td>
<td>Update Web Parts to display personalized information.</td>
</tr>
<tr>
<td><strong>UseClientIntegration</strong></td>
<td>Use features that launch client applications; otherwise, users must work on documents locally and upload changes.</td>
</tr>
<tr>
<td><strong>UseRemoteAPIs</strong></td>
<td>Use SOAP, WebDAV, or Microsoft Office SharePoint Designer 2007 interfaces to access the Web site.</td>
</tr>
<tr>
<td><strong>ViewFormPages</strong></td>
<td>View forms, views, and application pages, and enumerate lists.</td>
</tr>
<tr>
<td><strong>ViewListItems</strong></td>
<td>View items in lists, documents in document libraries, and view Web discussion comments.</td>
</tr>
<tr>
<td><strong>ViewPages</strong></td>
<td>View pages in a Web site.</td>
</tr>
<tr>
<td><strong>ViewUsageData</strong></td>
<td>View reports on Web site usage.</td>
</tr>
<tr>
<td><strong>ViewVersions</strong></td>
<td>View past versions of a list item or document.</td>
</tr>
</tbody>
</table>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/Development' rel='tag' target='_self'>Development</a>, <a class='technorati-link' href='http://technorati.com/tag/SharePoint' rel='tag' target='_self'>SharePoint</a>, <a class='technorati-link' href='http://technorati.com/tag/SharePoint+Designer' rel='tag' target='_self'>SharePoint Designer</a>, <a class='technorati-link' href='http://technorati.com/tag/web+parts' rel='tag' target='_self'>web parts</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://www.calvinirwin.net/2009/07/29/sharepoint-permissions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mysql &#8211; PHP &#8211; Linux and whats left of my sanity</title>
		<link>http://www.calvinirwin.net/2009/07/26/mysql-php-linux-and-whats-left-of-my-sanity/</link>
		<comments>http://www.calvinirwin.net/2009/07/26/mysql-php-linux-and-whats-left-of-my-sanity/#comments</comments>
		<pubDate>Sun, 26 Jul 2009 20:04:08 +0000</pubDate>
		<dc:creator>Calvin</dc:creator>
				<category><![CDATA[Configuration]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.calvinirwin.net/?p=58</guid>
		<description><![CDATA[So I have been working on setting up a Linux box with PHP5 and mysql mostly just to fart around with but also because I like learning how to do these things. I was having a hell of a time getting PHP and mysql to install properly on my distro - ubuntu 8
I originally installed [...]]]></description>
			<content:encoded><![CDATA[<p>So I have been working on setting up a Linux box with PHP5 and mysql mostly just to fart around with but also because I like learning how to do these things. I was having a hell of a time getting PHP and mysql to install properly on my distro - ubuntu 8</p>
<p>I originally installed PHP using apt-get and then installed mysql doing the same but was having issues getting them to work...no big shocker considering I am still fairly new to Linux. Eventually I did the following to get everything working, well so far anyway <img src='http://www.calvinirwin.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Here it is:</p>
<p>1. sudo tasksel install lamp-server - this installs the entire LAMP stack (Linux-Apache-MySQL-PHP) and does most of the work for you (i like this)</p>
<p>2. sudo apt-get install phpmyadmin - configure it for apache2 (installed above) this helped me get rid of the Fatal error: Call to undefined function: mysql_connect() I was getting...basically php was not configured to speak to mysql</p>
<p>3. I really cheated on this one because I was getting the following error Lost connection to MySQL server at ‘reading initial communication packet’, system error: 111 like any good linux noob I decided to google that up and came up with an article located <a style="font-family: arial;" href="http://imdad.wordpress.com/2008/11/02/2013-lost-connection-to-mysql-server-at-reading-initial-communication-packet-system-error-111/">here </a>that worked like a charm.  Here are the steps:</p>
<p>* <span style="font-family: courier new;">sudo gedit /etc/mysql/my.conf</span> -  comment the line corresponding to ‘bind-address’<br />
* <span style="font-family: courier new;">sudo gedit config.inc.php</span> - in the /etc/phpmyadmin folder<br />
* add or edit a line <span style="font-family: courier new;">$cfg['Servers'][$i]['host'] = ‘localhost’;</span><br />
* restart mysql using  <span style="font-family: courier new;">sudo /etc/init.d/mysql restart</span></p>
<p>Anyway...HTH</p>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/Configuration' rel='tag' target='_self'>Configuration</a>, <a class='technorati-link' href='http://technorati.com/tag/Development' rel='tag' target='_self'>Development</a>, <a class='technorati-link' href='http://technorati.com/tag/Linux' rel='tag' target='_self'>Linux</a>, <a class='technorati-link' href='http://technorati.com/tag/mysql' rel='tag' target='_self'>mysql</a>, <a class='technorati-link' href='http://technorati.com/tag/PHP' rel='tag' target='_self'>PHP</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://www.calvinirwin.net/2009/07/26/mysql-php-linux-and-whats-left-of-my-sanity/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SharePoint &#8211; Unexpected Error</title>
		<link>http://www.calvinirwin.net/2009/07/26/sharepoint-unexpected-error/</link>
		<comments>http://www.calvinirwin.net/2009/07/26/sharepoint-unexpected-error/#comments</comments>
		<pubDate>Sun, 26 Jul 2009 19:43:22 +0000</pubDate>
		<dc:creator>Calvin</dc:creator>
				<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[SharePoint]]></category>

		<guid isPermaLink="false">http://www.calvinirwin.net/?p=43</guid>
		<description><![CDATA[If you are like me and have experienced this amazing error...here is how you can pinpoint the problem....change the SafeMode tag in the web.config file to enable the CallStack attribute
&#60;safemode callstack="true" maxcontrols="200"&#62;
Then turn the customErrors mode to OFF. This should help you determine the problem.



Technorati Tags: ASP.NET, Development, error, SharePoint


]]></description>
			<content:encoded><![CDATA[<p>If you are like me and have experienced this amazing error...here is how you can pinpoint the problem....change the SafeMode tag in the web.config file to enable the CallStack attribute</p>
<p>&lt;safemode callstack="true" maxcontrols="200"&gt;</p>
<p>Then turn the <em>customErrors</em> mode to OFF. This should help you determine the problem.</p>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/ASP.NET' rel='tag' target='_self'>ASP.NET</a>, <a class='technorati-link' href='http://technorati.com/tag/Development' rel='tag' target='_self'>Development</a>, <a class='technorati-link' href='http://technorati.com/tag/error' rel='tag' target='_self'>error</a>, <a class='technorati-link' href='http://technorati.com/tag/SharePoint' rel='tag' target='_self'>SharePoint</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://www.calvinirwin.net/2009/07/26/sharepoint-unexpected-error/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DevConnections Wrap Up &#8211; Nov 2008</title>
		<link>http://www.calvinirwin.net/2009/07/26/devconnections-wrap-up-nov-2008/</link>
		<comments>http://www.calvinirwin.net/2009/07/26/devconnections-wrap-up-nov-2008/#comments</comments>
		<pubDate>Sun, 26 Jul 2009 19:39:47 +0000</pubDate>
		<dc:creator>Calvin</dc:creator>
				<category><![CDATA[.Net Framework]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Configuration]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[conference]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[sql server 2005]]></category>

		<guid isPermaLink="false">http://www.calvinirwin.net/?p=41</guid>
		<description><![CDATA[From November 2008:
Whew...its been a long week and its only Thursday. This years conference was much the same as last years with the exception of being held in various portions of the Mandalay Bay convention center as opposed to on one floor. This made for lots and lots and lots and lots of walking. But [...]]]></description>
			<content:encoded><![CDATA[<p>From November 2008:</p>
<p>Whew...its been a long week and its only Thursday. This years conference was much the same as last years with the exception of being held in various portions of the Mandalay Bay convention center as opposed to on one floor. This made for lots and lots and lots and lots of walking. But I'm still young (yes i am) so it makes for good excercise to walk off all the food they shovel in your mouth.</p>
<p>Most of the sessions I attended were really good with the exception of a couple. I wouldn't blame the speakers because these problems were mostly due to technical issues like the computers not working, the projectors broken or feedback in the presenters microphone sort of thing. All in all there were some great things presented this week.</p>
<p>Some of the sessions that really stuck out were:</p>
<p><a href="http://www.sqlskills.com/blogs/kimberly/">Kimberly Tripp </a>- Index Internals and Usage<br />
This was a great session that talked about thins like SQL Server Statistics, Query Optimization, Types of indexes, diminishing returns on performance, etc. Of all the session I think this one stood out the most and because it is probably the most relevant for me right now being one of the "SQL Server DBA" for my company (<a href="http://www.christiedigital.com/">Christie Digital</a>). I say it that way because its a committee based DBA <img src='http://www.calvinirwin.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a href="http://www.west-wind.com/Weblog/">Rick Strahl </a>- Using WCF for JSON and REST Services with ASP.Net</p>
<p>Great session....last one of the conference for me so it really sticks out but essentially this covers the next gen replacement for ASMX or first gen webservices in the .NET Framework.</p>
<p><a href="http://www.johnpapa.net/">John Papa</a> - Practical Strategies with the Entity Framework</p>
<p>For me this was an introduction to the Entity Framework that was released in VS 2008 SP1. John did a great job of quickly introducing the technology and getting on to the meat and potatoes of what we were there to discuss. There was a good discussion on how to use the IDE to build the data mappings and what happens after you make changes to the backend server, which coinceidently can be any data source...not just SQL as Linq to SQL supports.</p>
<p>Things I would change...(and only because its my blog and I can say whatever I want!!!)</p>
<p>...the time between sessions was ridiculous...one hour or in some cases and hour and a half is just way too long. They could have added an extra session or two to the day. I realize they want you in the expo hall but they could have extended the day to facilitate that or leave it open all day and then some people may skip a couple of sessions here and there to go and see what the vendors are offering. this was my gripe last year and its my gripe this year. Its probably going to be the thing that keeps me from going to this in the future.</p>
<p>...provide video or podcasts of the sessions so we can take in the whole conference...even the sessions we didn't get to go to. I see there point about this being intellectual property and the speakers are consultants and this is their livelyhood but I mean if they are willing to teach this at a conference...and we pay to see it...shouldn't we be entitled to review this information after the fact? Maybe they will supply it on their site (i heard they were recording the sessions this year).</p>
<p>...ease up on the food. Damn, there was too much...I ate too much...I felt stuffed the whole time...I guess this is really my fault! Okay dont change that <img src='http://www.calvinirwin.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/.net' rel='tag' target='_self'>.net</a>, <a class='technorati-link' href='http://technorati.com/tag/ASP.NET' rel='tag' target='_self'>ASP.NET</a>, <a class='technorati-link' href='http://technorati.com/tag/conference' rel='tag' target='_self'>conference</a>, <a class='technorati-link' href='http://technorati.com/tag/Development' rel='tag' target='_self'>Development</a>, <a class='technorati-link' href='http://technorati.com/tag/SharePoint' rel='tag' target='_self'>SharePoint</a>, <a class='technorati-link' href='http://technorati.com/tag/SQL+Server' rel='tag' target='_self'>SQL Server</a>, <a class='technorati-link' href='http://technorati.com/tag/sql+server+2005' rel='tag' target='_self'>sql server 2005</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://www.calvinirwin.net/2009/07/26/devconnections-wrap-up-nov-2008/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SharePoint and its so called Designer&#8230;ARRRRRGGGGGHHHHH</title>
		<link>http://www.calvinirwin.net/2009/07/26/sharepoint-and-its-so-called-designer-arrrrrggggghhhhh/</link>
		<comments>http://www.calvinirwin.net/2009/07/26/sharepoint-and-its-so-called-designer-arrrrrggggghhhhh/#comments</comments>
		<pubDate>Sun, 26 Jul 2009 19:19:02 +0000</pubDate>
		<dc:creator>Calvin</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint Designer]]></category>

		<guid isPermaLink="false">http://www.calvinirwin.net/?p=34</guid>
		<description><![CDATA[I have never in my life dealt with or had the "pleasure" of using a tool quite like Sharepoint Designer. First off I am a developer...so can they roll this thing into Visual Studio already? maybe then it will behave like my usual IDE...you know intellisense, fade away tool boxes and solution explorer. (Some of [...]]]></description>
			<content:encoded><![CDATA[<p>I have never in my life dealt with or had the "pleasure" of using a tool quite like Sharepoint Designer. First off I am a developer...so can they roll this thing into Visual Studio already? maybe then it will behave like my usual IDE...you know intellisense, fade away tool boxes and solution explorer. (Some of these issues are sharepoint itself but...this app is where i figured it out so i am adding it here)<br />
So what makes me hate it?</p>
<p>...hmm did you know that you have to leave the ListFormWebPart on all the edit, insert and display forms for a list even if you want to customize them? Seems kind of odd to me and quite frankly where is this documented...shouldn't SPD at least say something to that effect...or dammit MS add it as a comment on the page somewhere.</p>
<p>...how about leaving my HTML code alone when i am done formatting it please!!!! Its like I am working in VS2002 again...no thanks</p>
<p>...the CustomListForm web part does not give you the ability to attach files...even though its right there on the toolbar it gives you the nice "You cannot attach a file because the form was customized". Thanks captain obvious...I think this is one of those sick jokes where every time you click on it a counter in Redmond increments by one and some sick developer is there laughing his ass off...heres to you buddy! Kudos to Marc Davis for his workaround <a href="http://cid-6d5649bcab6a7f93.spaces.live.com/blog/cns%216D5649BCAB6A7F93%21130.entry">posted here</a></p>
<p>...isn't it funny how the css file core.css is always the last css added to the list. Sure you can bypass it with the Alternate stylesheeet and/or using a hard coded link tag...but that just seems dumb to me.</p>
<p>...can I have an easier way to develop and debug code in sharepoint...sure I know I can build, deploy to the GAC and attach....but its a bit of a pain in the ass.</p>
<p>...Customized file and uncustomized files. Yes i get the gist of it and i believe this is a good thing....scenario - I have made numerous edits to a file - I choose to revert to the site definition - I don't get my original file back...I get some hybrid bastardized file that is completely useless to me...ummmm....again...not funny.</p>
<p>- I had a problem with one of my lists (pertaining to the ListFormWebPart not being there) and I was looking around on the internet...here is what I found <a href="http://support.microsoft.com/kb/935504">this article here</a> you can read it if you want but it basically says hey...just delete your list and recreate it....HA HA HA I love those simple "fixes".</p>
<p>...theres been other things but I cant remember them right now....too tired.</p>
<p>So these are my ramblings...I am kinda stuck with SharePoint now but if they could fix some of these very-time consuming problems it would make mine and judging from the problems people are having online a lot of other peoples jobs a lot easier. I mean isn't that what Microsoft has been promising all this time...</p>
<p>I'll stop now...happy SharePointing.</p>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/Development' rel='tag' target='_self'>Development</a>, <a class='technorati-link' href='http://technorati.com/tag/error' rel='tag' target='_self'>error</a>, <a class='technorati-link' href='http://technorati.com/tag/SharePoint' rel='tag' target='_self'>SharePoint</a>, <a class='technorati-link' href='http://technorati.com/tag/SharePoint+Designer' rel='tag' target='_self'>SharePoint Designer</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://www.calvinirwin.net/2009/07/26/sharepoint-and-its-so-called-designer-arrrrrggggghhhhh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
