<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Structured and repeatable deployment of Lookup fields</title>
	<atom:link href="http://blog.mastykarz.nl/structured-and-repeatable-deployment-of-lookup-fields/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.mastykarz.nl/structured-and-repeatable-deployment-of-lookup-fields/</link>
	<description>Innovation Matters &#124; SharePoint Server MVP &#124; ISSN 2210-9390</description>
	<lastBuildDate>Wed, 08 Sep 2010 18:25:54 +0200</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Waldek Mastykarz</title>
		<link>http://blog.mastykarz.nl/structured-and-repeatable-deployment-of-lookup-fields/comment-page-1/#comment-12797</link>
		<dc:creator>Waldek Mastykarz</dc:creator>
		<pubDate>Sun, 22 Feb 2009 09:55:36 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mastykarz.nl/2008/05/28/structured-and-repeatable-deployment-of-lookup-fields/#comment-12797</guid>
		<description>@Prat: The control I have made for this article was more of a me-ware (works only on my setup ;)). I&#039;d have to spend some more time to make it releasable. I&#039;d definitely keep that in mind and will let you know as soon as it becomes publicly available.</description>
		<content:encoded><![CDATA[<p>@Prat: The control I have made for this article was more of a me-ware (works only on my setup <img src='http://blog.mastykarz.nl/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> ). I&#039;d have to spend some more time to make it releasable. I&#039;d definitely keep that in mind and will let you know as soon as it becomes publicly available.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Prat</title>
		<link>http://blog.mastykarz.nl/structured-and-repeatable-deployment-of-lookup-fields/comment-page-1/#comment-12409</link>
		<dc:creator>Prat</dc:creator>
		<pubDate>Mon, 16 Feb 2009 09:39:22 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mastykarz.nl/2008/05/28/structured-and-repeatable-deployment-of-lookup-fields/#comment-12409</guid>
		<description>Waldek,
Can you post the source code that sheds some light on me in terms of understanding more and implement the same.

THanks,
Prat</description>
		<content:encoded><![CDATA[<p>Waldek,<br />
Can you post the source code that sheds some light on me in terms of understanding more and implement the same.</p>
<p>THanks,<br />
Prat</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Waldek Mastykarz</title>
		<link>http://blog.mastykarz.nl/structured-and-repeatable-deployment-of-lookup-fields/comment-page-1/#comment-5216</link>
		<dc:creator>Waldek Mastykarz</dc:creator>
		<pubDate>Sat, 16 Aug 2008 13:01:09 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mastykarz.nl/2008/05/28/structured-and-repeatable-deployment-of-lookup-fields/#comment-5216</guid>
		<description>Thanks for sharing the idea, C3. I think it&#039;s a good point. I haven&#039;t tried that approach myself but it definitely seems plausible. The only concern is discrepancy between the XML configuration of the Lookup Field and setting the actual ID from the code behind. While it&#039;s definitely simpler than the approach I have suggested, the problem of storing the configuration and keeping the overview still remains in my opinion.</description>
		<content:encoded><![CDATA[<p>Thanks for sharing the idea, C3. I think it&#039;s a good point. I haven&#039;t tried that approach myself but it definitely seems plausible. The only concern is discrepancy between the XML configuration of the Lookup Field and setting the actual ID from the code behind. While it&#039;s definitely simpler than the approach I have suggested, the problem of storing the configuration and keeping the overview still remains in my opinion.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: C3</title>
		<link>http://blog.mastykarz.nl/structured-and-repeatable-deployment-of-lookup-fields/comment-page-1/#comment-5207</link>
		<dc:creator>C3</dc:creator>
		<pubDate>Fri, 15 Aug 2008 22:57:58 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mastykarz.nl/2008/05/28/structured-and-repeatable-deployment-of-lookup-fields/#comment-5207</guid>
		<description>...but what if you can set the LookupList property for an existing field?

As you know, the setter of a LookupList property for a SPFieldLookup object is coded to throw an SPException if you try set it to a value other than what it already is.

So the solution is simple; bypass the property.

The LookupList&#039;s property value is actually stored using the base SPField&#039;s SetFieldAttributeValue function, in a attribute called &quot;List&quot;.  So, with the miracle of relfection:

SPFieldLookup lkpFld = {get the lookup field from the Fields collection of the list)

System.Reflection.MethodInfo mi = lkpFld.GetType().BaseType.GetMethod(&quot;SetFieldAttributeValue&quot;, BindingFlags.NonPublic &#124; BindingFlags.Instance);

mi.Invoke(lkpFld,new object[]{(string)&quot;List&quot;,{YourListID});

lkpFld.Update();

And presto chango, your lookup field now points to the new list ID.

Incidentally, you can set that property to &quot;Self&quot;, making the LookupList getter return the ListID of the field&#039;s parent list.

I&#039;d also like to mention the LookupWebID property, which does not throw nasty exceptions.  Since that property enables accessing lists from other sites.  Maybe everyone else knows that already, but I didn&#039;t.</description>
		<content:encoded><![CDATA[<p>&#8230;but what if you can set the LookupList property for an existing field?</p>
<p>As you know, the setter of a LookupList property for a SPFieldLookup object is coded to throw an SPException if you try set it to a value other than what it already is.</p>
<p>So the solution is simple; bypass the property.</p>
<p>The LookupList&#039;s property value is actually stored using the base SPField&#039;s SetFieldAttributeValue function, in a attribute called &#034;List&#034;.  So, with the miracle of relfection:</p>
<p>SPFieldLookup lkpFld = {get the lookup field from the Fields collection of the list)</p>
<p>System.Reflection.MethodInfo mi = lkpFld.GetType().BaseType.GetMethod(&#034;SetFieldAttributeValue&#034;, BindingFlags.NonPublic | BindingFlags.Instance);</p>
<p>mi.Invoke(lkpFld,new object[]{(string)&#034;List&#034;,{YourListID});</p>
<p>lkpFld.Update();</p>
<p>And presto chango, your lookup field now points to the new list ID.</p>
<p>Incidentally, you can set that property to &#034;Self&#034;, making the LookupList getter return the ListID of the field&#039;s parent list.</p>
<p>I&#039;d also like to mention the LookupWebID property, which does not throw nasty exceptions.  Since that property enables accessing lists from other sites.  Maybe everyone else knows that already, but I didn&#039;t.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TSz</title>
		<link>http://blog.mastykarz.nl/structured-and-repeatable-deployment-of-lookup-fields/comment-page-1/#comment-576</link>
		<dc:creator>TSz</dc:creator>
		<pubDate>Sun, 01 Jun 2008 14:10:45 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mastykarz.nl/2008/05/28/structured-and-repeatable-deployment-of-lookup-fields/#comment-576</guid>
		<description>I&#039;m not sure if this can be fixed as classes used for lookup functionality are documented features of Sharepoint, so probably wouldn&#039;t be changed in this version of Sharepoint.
As for lookup field type this is a very ugly part of Sharepoint 2007 architecture. It is possible to overcome problems of lookup fieldtype inheritance (IT-Dev View Filtered Lookup inherits from Sharepoint Lookup and works well also in multi mode), however client applications are hard coded for built in lookup and there is no possibility to use types derived from lookup. This is a really bad design example indeed.</description>
		<content:encoded><![CDATA[<p>I&#039;m not sure if this can be fixed as classes used for lookup functionality are documented features of Sharepoint, so probably wouldn&#039;t be changed in this version of Sharepoint.<br />
As for lookup field type this is a very ugly part of Sharepoint 2007 architecture. It is possible to overcome problems of lookup fieldtype inheritance (IT-Dev View Filtered Lookup inherits from Sharepoint Lookup and works well also in multi mode), however client applications are hard coded for built in lookup and there is no possibility to use types derived from lookup. This is a really bad design example indeed.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Waldek Mastykarz</title>
		<link>http://blog.mastykarz.nl/structured-and-repeatable-deployment-of-lookup-fields/comment-page-1/#comment-564</link>
		<dc:creator>Waldek Mastykarz</dc:creator>
		<pubDate>Thu, 29 May 2008 14:51:57 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mastykarz.nl/2008/05/28/structured-and-repeatable-deployment-of-lookup-fields/#comment-564</guid>
		<description>Although I&#039;m not really sure if the WSS team is planning to release such a fix, I definitely hope it would come out or they would at least provide an alternative like a new Field Type which would leverage the concept of structured and repeatable deployment.</description>
		<content:encoded><![CDATA[<p>Although I&#039;m not really sure if the WSS team is planning to release such a fix, I definitely hope it would come out or they would at least provide an alternative like a new Field Type which would leverage the concept of structured and repeatable deployment.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric Bartels</title>
		<link>http://blog.mastykarz.nl/structured-and-repeatable-deployment-of-lookup-fields/comment-page-1/#comment-563</link>
		<dc:creator>Eric Bartels</dc:creator>
		<pubDate>Thu, 29 May 2008 13:07:01 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mastykarz.nl/2008/05/28/structured-and-repeatable-deployment-of-lookup-fields/#comment-563</guid>
		<description>I&#039;m struggling with the same problems. I really cannot see any reason why MS implemented it in this way. I see this as a major flaw in the design.
I hope this will be changed in SP2 :-)</description>
		<content:encoded><![CDATA[<p>I&#039;m struggling with the same problems. I really cannot see any reason why MS implemented it in this way. I see this as a major flaw in the design.<br />
I hope this will be changed in SP2 <img src='http://blog.mastykarz.nl/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
</channel>
</rss>
