<?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>entwicklungsgedanken &#187; SharePoint-Development</title>
	<atom:link href="http://www.entwicklungsgedanken.de/category/sharepoint/sharepoint-dev/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.entwicklungsgedanken.de</link>
	<description>Verschiedene Gedanken rund um die Softwareentwicklung</description>
	<lastBuildDate>Mon, 09 Jan 2012 14:47:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Bug with Internet Explorer and grid RowEditing-plugin when using scoped-theme</title>
		<link>http://www.entwicklungsgedanken.de/2012/01/09/bug-with-internet-explorer-and-grid-rowediting-plugin-when-using-scoped-theme/</link>
		<comments>http://www.entwicklungsgedanken.de/2012/01/09/bug-with-internet-explorer-and-grid-rowediting-plugin-when-using-scoped-theme/#comments</comments>
		<pubDate>Mon, 09 Jan 2012 14:47:42 +0000</pubDate>
		<dc:creator>Eric Bartels</dc:creator>
				<category><![CDATA[SharePoint-Development]]></category>
		<category><![CDATA[Webdevelopment]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[extjs]]></category>
		<category><![CDATA[extjs4]]></category>
		<category><![CDATA[grid]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[override]]></category>
		<category><![CDATA[RowEditing]]></category>
		<category><![CDATA[scoped-theme]]></category>
		<category><![CDATA[sencha]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SP2010]]></category>

		<guid isPermaLink="false">http://www.entwicklungsgedanken.de/?p=500</guid>
		<description><![CDATA[I came across this rare bug in the current development of a project. It makes heavy use of the RowEditing plugin of Extjs&#8216; grid. Because the Extjs environment is used within SharePoint 2010 I have to use the scoped theme to avoid &#8220;damage&#8221; to the SharePoint UI. After inserting a record into the grid via [...]]]></description>
			<content:encoded><![CDATA[<p>I came across this rare bug in the current development of a project. It makes heavy use of the <a title="RowEditing plugin" href="http://docs.sencha.com/ext-js/4-0/#!/api/Ext.grid.plugin.RowEditing">RowEditing plugin</a> of <a title="Exjts" href="http://docs.sencha.com/ext-js/4-0/">Extjs</a>&#8216; grid. Because the Extjs environment is used within SharePoint 2010 I have to use the scoped theme to avoid &#8220;damage&#8221; to the SharePoint UI.</p>
<p>After inserting a record into the grid via RowEditing and pressing cancel the RowEditings&#8217; editor window is not shown. You guess it right: only when using Internet Explorer (7, 8, 9). After testing it showed that the css itself is not the reason. So debugging the Extjs-source where the setting <code>scopeResetCSS</code> is evaluated&#8230;</p>
<p>The final result is a workaround applied via <a title="Ext.override api" href="http://docs.sencha.com/ext-js/4-0/#!/api/Ext-method-override">Ext.override</a> to solve the &#8220;problem&#8221;.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>Ext.<span style="color: #660066;">isIE</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  Ext.<span style="color: #660066;">AbstractComponent</span>.<span style="color: #660066;">override</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
    onRender<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>container<span style="color: #339933;">,</span> position<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #003366; font-weight: bold;">var</span> me <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">,</span>
        el <span style="color: #339933;">=</span> me.<span style="color: #660066;">el</span><span style="color: #339933;">,</span>
        styles <span style="color: #339933;">=</span> me.<span style="color: #660066;">initStyles</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
        renderTpl<span style="color: #339933;">,</span> renderData<span style="color: #339933;">,</span> i<span style="color: #339933;">;</span>
&nbsp;
      position <span style="color: #339933;">=</span> me.<span style="color: #660066;">getInsertPosition</span><span style="color: #009900;">&#40;</span>position<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
      <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>el<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>position<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
          el <span style="color: #339933;">=</span> Ext.<span style="color: #660066;">DomHelper</span>.<span style="color: #660066;">insertBefore</span><span style="color: #009900;">&#40;</span>position<span style="color: #339933;">,</span> me.<span style="color: #660066;">getElConfig</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
          el <span style="color: #339933;">=</span> Ext.<span style="color: #660066;">DomHelper</span>.<span style="color: #660066;">append</span><span style="color: #009900;">&#40;</span>container<span style="color: #339933;">,</span> me.<span style="color: #660066;">getElConfig</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
      <span style="color: #009900;">&#125;</span>
      <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>me.<span style="color: #660066;">allowDomMove</span> <span style="color: #339933;">!==</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>position<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
          container.<span style="color: #660066;">dom</span>.<span style="color: #660066;">insertBefore</span><span style="color: #009900;">&#40;</span>el.<span style="color: #660066;">dom</span><span style="color: #339933;">,</span> position<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
          container.<span style="color: #660066;">dom</span>.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>el.<span style="color: #660066;">dom</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
      <span style="color: #009900;">&#125;</span>
&nbsp;
      <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>Ext.<span style="color: #660066;">scopeResetCSS</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;&amp;</span>amp<span style="color: #339933;">;</span> <span style="color: #339933;">!</span>me.<span style="color: #660066;">ownerCt</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
        <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>el.<span style="color: #660066;">dom</span> <span style="color: #339933;">==</span> Ext.<span style="color: #660066;">getBody</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">dom</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
          el.<span style="color: #660066;">parent</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addCls</span><span style="color: #009900;">&#40;</span>Ext.<span style="color: #660066;">baseCSSPrefix</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'reset'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
          <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>me.$className <span style="color: #339933;">!=</span> <span style="color: #3366CC;">'Ext.grid.RowEditor'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            me.<span style="color: #660066;">resetEl</span> <span style="color: #339933;">=</span> el.<span style="color: #660066;">wrap</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
              cls<span style="color: #339933;">:</span> Ext.<span style="color: #660066;">baseCSSPrefix</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'reset'</span>
            <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
          <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
      <span style="color: #009900;">&#125;</span>
&nbsp;
      me.<span style="color: #660066;">setUI</span><span style="color: #009900;">&#40;</span>me.<span style="color: #660066;">ui</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
      el.<span style="color: #660066;">addCls</span><span style="color: #009900;">&#40;</span>me.<span style="color: #660066;">initCls</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      el.<span style="color: #660066;">setStyle</span><span style="color: #009900;">&#40;</span>styles<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      me.<span style="color: #660066;">el</span> <span style="color: #339933;">=</span> el<span style="color: #339933;">;</span>
&nbsp;
      me.<span style="color: #660066;">initFrame</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
      renderTpl <span style="color: #339933;">=</span> me.<span style="color: #660066;">initRenderTpl</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>renderTpl<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        renderData <span style="color: #339933;">=</span> me.<span style="color: #660066;">initRenderData</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        renderTpl.<span style="color: #660066;">append</span><span style="color: #009900;">&#40;</span>me.<span style="color: #660066;">getTargetEl</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> renderData<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
&nbsp;
      me.<span style="color: #660066;">applyRenderSelectors</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
      me.<span style="color: #660066;">rendered</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>The woraround itself is only this:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>me.$className <span style="color: #339933;">!=</span> <span style="color: #3366CC;">'Ext.grid.RowEditor'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  me.<span style="color: #660066;">resetEl</span> <span style="color: #339933;">=</span> el.<span style="color: #660066;">wrap</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
    cls<span style="color: #339933;">:</span> Ext.<span style="color: #660066;">baseCSSPrefix</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'reset'</span>
  <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>BTW: I &#8220;love&#8221; IE!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.entwicklungsgedanken.de/2012/01/09/bug-with-internet-explorer-and-grid-rowediting-plugin-when-using-scoped-theme/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enable-SPFeature does not trigger the feature receiver</title>
		<link>http://www.entwicklungsgedanken.de/2011/06/08/enable-spfeature-does-not-trigger-the-feature-receiver/</link>
		<comments>http://www.entwicklungsgedanken.de/2011/06/08/enable-spfeature-does-not-trigger-the-feature-receiver/#comments</comments>
		<pubDate>Wed, 08 Jun 2011 10:19:01 +0000</pubDate>
		<dc:creator>Eric Bartels</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint-Development]]></category>
		<category><![CDATA[Enable-SPFeature]]></category>
		<category><![CDATA[feature]]></category>
		<category><![CDATA[powershell]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[SPFeatureReceiver]]></category>

		<guid isPermaLink="false">http://www.entwicklungsgedanken.de/?p=473</guid>
		<description><![CDATA[Today I encountered the same problem as stated in a blog post by Christopher Maish. When activating the feature via powershell the associated feature receiver was not called. Trying the suggested solution in the blog post drove me to the cause of this problem. When using stsadm I got an &#8220;access denied&#8221; error. I did [...]]]></description>
			<content:encoded><![CDATA[<p>Today I encountered the same problem as stated in a <a href="http://www.christophermaish.com/blog/featureactivated-not-called">blog post by Christopher Maish</a>. When activating the feature via powershell the associated feature receiver was not called.</p>
<p>Trying the suggested solution in the blog post drove me to the cause of this problem. When using stsadm I got an &#8220;access denied&#8221; error.<br /> I did run my script via Powershell ISE within Windows Server 2008.</p>
<p>So the real problem is caused, again, by <strong>UAC (User Account Control)</strong>. When starting the Powershell ISE with <strong>&#8220;Run as administrator&#8221;</strong> and executing the script the feature receiver is now called as expected. Even when using Enable-SPFeature!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.entwicklungsgedanken.de/2011/06/08/enable-spfeature-does-not-trigger-the-feature-receiver/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using powershell to quickly debug SPSiteDataQuery</title>
		<link>http://www.entwicklungsgedanken.de/2011/06/07/using-powershell-to-quickly-debug-spsitedataquery/</link>
		<comments>http://www.entwicklungsgedanken.de/2011/06/07/using-powershell-to-quickly-debug-spsitedataquery/#comments</comments>
		<pubDate>Tue, 07 Jun 2011 08:43:11 +0000</pubDate>
		<dc:creator>Eric Bartels</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint-Development]]></category>
		<category><![CDATA[Debug]]></category>
		<category><![CDATA[powershell]]></category>
		<category><![CDATA[SPSiteDataQuery]]></category>

		<guid isPermaLink="false">http://www.entwicklungsgedanken.de/?p=459</guid>
		<description><![CDATA[Writing CAML-Queries is still no fun. Even with SharePoint 2010&#8230; So you often need to test your queries before they actually work. In case you quickly want to test if your SPSiteDataQuery is correct you can use powershell to &#8220;debug&#8221; it. Just create an instance of the site-collection and target the root-web with your query-instance. [...]]]></description>
			<content:encoded><![CDATA[<p>Writing CAML-Queries is still no fun. Even with SharePoint 2010&#8230; So you often need to test your queries before they actually work.</p>
<p>In case you quickly want to test if your SPSiteDataQuery is correct you can use powershell to &#8220;debug&#8221; it. Just create an instance of the site-collection and target the root-web with your query-instance.</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #800080;">$site</span> <span style="color: pink;">=</span> Get<span style="color: pink;">-</span>SPSite <span style="color: pink;">-</span>Identity http:<span style="color: pink;">//</span>my<span style="color: pink;">-</span>site<span style="color: pink;">-</span>collection
&nbsp;
<span style="color: #800080;">$q</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">New-Object</span> <span style="color: #008080; font-style: italic;">-typeName</span> Microsoft.SharePoint.SPSiteDataQuery
<span style="color: #800080;">$q</span>.Query <span style="color: pink;">=</span> <span style="color: #800000;">&quot;&lt;Where&gt;&lt;And&gt;&lt;Eq&gt;&lt;FieldRef Name='ContentType'/&gt;&lt;Value Type='Text'&gt;MyCT&lt;/Value&gt;&lt;/Eq&gt;&lt;BeginsWith&gt;&lt;FieldRef Name='Url'/&gt;&lt;Value Type='URL'&gt;/path&lt;/Value&gt;&lt;/BeginsWith&gt;&lt;/And&gt;&lt;/Where&gt;&quot;</span>
<span style="color: #800080;">$q</span>.ViewFields <span style="color: pink;">=</span> <span style="color: #800000;">&quot;&lt;FieldRef Name='ID'/&gt;&lt;FieldRef Name='ContentType'/&gt;&quot;</span>
<span style="color: #800080;">$q</span>.Webs <span style="color: pink;">=</span> <span style="color: #800000;">&quot;&lt;Webs Scope='SiteCollection' /&gt;&quot;</span>
&nbsp;
<span style="color: #800080;">$site</span>.RootWeb.GetSiteData<span style="color: #000000;">&#40;</span><span style="color: #800080;">$q</span><span style="color: #000000;">&#41;</span></pre></div></div>

<p>This is way faster than doing it in VS&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.entwicklungsgedanken.de/2011/06/07/using-powershell-to-quickly-debug-spsitedataquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using a C# preprocessor directive for testing custom timer-jobs</title>
		<link>http://www.entwicklungsgedanken.de/2010/07/22/using-a-c-preprocessor-directive-for-testing-custom-timer-jobs/</link>
		<comments>http://www.entwicklungsgedanken.de/2010/07/22/using-a-c-preprocessor-directive-for-testing-custom-timer-jobs/#comments</comments>
		<pubDate>Thu, 22 Jul 2010 20:42:00 +0000</pubDate>
		<dc:creator>Eric Bartels</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint-Development]]></category>
		<category><![CDATA[preprocessor]]></category>
		<category><![CDATA[SPJobDefinition]]></category>
		<category><![CDATA[Timer job]]></category>
		<category><![CDATA[tip]]></category>

		<guid isPermaLink="false">http://www.entwicklungsgedanken.de/?p=425</guid>
		<description><![CDATA[If your are writing custom timer-jobs for your SharePoint solution it will happen that you write jobs which are only executed once a day or even less often. As a developer you cannot wait that long&#8230; You could of course comment in and out (via ctrl + k, ctrl + c / ctrl + k, [...]]]></description>
			<content:encoded><![CDATA[<p>If your are writing custom timer-jobs for your SharePoint solution it will happen that you write jobs which are only executed once a day or even less often. As a developer you cannot wait that long&#8230;</p>
<p>You could of course comment in and out (via ctrl + k, ctrl + c / ctrl + k, ctrl + u) the <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spschedule.aspx">SPSchedule</a> used by the timer-job during debug-mode. But this is error-prone.</p>
<p>When using a <a href="http://msdn.microsoft.com/en-us/library/ed8yd1ha(VS.71).aspx">C# preprocessor directive</a> you cannot forget to switch back to the &#8220;production schedule&#8221; as this is done automatically (and even with syntax-highlighting depending on the active configuration!) when selecting the &#8220;release build&#8221;.</p>
<p><code lang="csharp"><br />
#if (DEBUG)<br />
var schedule = new SPMinuteSchedule();<br />
schedule.BeginSecond = 1;<br />
schedule.EndSecond = 59;<br />
schedule.Interval = 5;<br />
#else<br />
var schedule = new SPDailySchedule();<br />
schedule.BeginHour = 7;<br />
schedule.EndHour = 7;<br />
schedule.BeginMinute = 1;<br />
schedule.EndMinute = 59;<br />
#endif<br />
</code><br />
This code tells the compiler to use the <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spminuteschedule.aspx">SPMinuteSchedule</a> when compiling the &#8220;debug build&#8221; and to use the <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spdailyschedule.aspx">SPDailySchedule</a> when compiling in &#8220;release build&#8221;. All automatically!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.entwicklungsgedanken.de/2010/07/22/using-a-c-preprocessor-directive-for-testing-custom-timer-jobs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Updating existing lookup fields in SharePoint</title>
		<link>http://www.entwicklungsgedanken.de/2010/02/01/updating-existing-lookup-fields-in-sharepoint/</link>
		<comments>http://www.entwicklungsgedanken.de/2010/02/01/updating-existing-lookup-fields-in-sharepoint/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 11:39:50 +0000</pubDate>
		<dc:creator>Eric Bartels</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint-Development]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[lookup]]></category>
		<category><![CDATA[Regex]]></category>
		<category><![CDATA[SchemaXml]]></category>
		<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://www.entwicklungsgedanken.de/2010/02/01/updating-existing-lookup-fields-in-sharepoint/</guid>
		<description><![CDATA[Creating lookup-fields only via XML-Definition is not possible. You need the ID of the Web hosting the list and the ID of the list hosting the data the lookup field is connected to. This information can only be retrieved when both entities are created… Object model?! When looking into the SPFieldLookup-class you find the properties [...]]]></description>
			<content:encoded><![CDATA[<p>Creating lookup-fields only via XML-Definition is not possible. You need the ID of the Web hosting the list and the ID of the list hosting the data the lookup field is connected to. This information can only be retrieved when both entities are created…</p>
<h3>Object model?!</h3>
<p>When looking into the <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfieldlookup.aspx">SPFieldLookup</a>-class you find the properties LookupField, LookupList and LookupWebId. LookupWebId and LookupField can easily be set via the object model. The documentation says that <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfieldlookup.lookuplist.aspx">LookupList is read and writeable</a> which is not true. Setting LookupList throws an exception stating out “Cannot change the lookup list of the lookup field.”.</p>
<h3>SchemaXml and Regex to the rescue</h3>
<p>The <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfield.schemaxml.aspx">SchemaXml-property</a> of a SPField can be used to manipulate the LookupList. One stumbling block is that you do not know the Guid of the LookupList currently stored in the schema. Even if you define a Guid inside your xml-field-definition SharePoint puts in an other Guid. Here a simple regular expression comes to help.</p>
<p><strong>The code for connecting a site-column with a list somewhere in some web:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #008080; font-style: italic;">// Declarations (myWeb is the context given by a feature receiver scoped &quot;web&quot;)</span>
var rx <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Regex<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;List=<span style="color: #008080; font-weight: bold;">\&quot;</span>([^<span style="color: #008080; font-weight: bold;">\&quot;</span>]*)<span style="color: #008080; font-weight: bold;">\&quot;</span>&quot;</span>, RegexOptions<span style="color: #008000;">.</span><span style="color: #0000FF;">IgnoreCase</span> <span style="color: #008000;">|</span> RegexOptions<span style="color: #008000;">.</span><span style="color: #0000FF;">ECMAScript</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
var root <span style="color: #008000;">=</span> myWeb<span style="color: #008000;">.</span><span style="color: #0000FF;">Site</span><span style="color: #008000;">.</span><span style="color: #0000FF;">RootWeb</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #008080; font-style: italic;">// myListInstance is an instance of a SPList existing somewhere</span>
var lookupField <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span>SPFieldLookup<span style="color: #008000;">&#41;</span>root<span style="color: #008000;">.</span><span style="color: #0000FF;">Fields</span><span style="color: #008000;">&#91;</span><span style="color: #666666;">&quot;MyLookupField&quot;</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
var xml <span style="color: #008000;">=</span> lookupField<span style="color: #008000;">.</span><span style="color: #0000FF;">SchemaXml</span><span style="color: #008000;">;</span>
xml <span style="color: #008000;">=</span> rx<span style="color: #008000;">.</span><span style="color: #0000FF;">Replace</span><span style="color: #008000;">&#40;</span>xml, <span style="color: #6666cc; font-weight: bold;">String</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Format</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;List=<span style="color: #008080; font-weight: bold;">\&quot;</span>{0}<span style="color: #008080; font-weight: bold;">\&quot;</span>&quot;</span>, myListInstance<span style="color: #008000;">.</span><span style="color: #0000FF;">ID</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;B&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
lookupField<span style="color: #008000;">.</span><span style="color: #0000FF;">SchemaXml</span> <span style="color: #008000;">=</span> xml<span style="color: #008000;">;</span>
<span style="color: #008080; font-style: italic;">// Do not call update here!</span>
<span style="color: #008080; font-style: italic;">// Quote from MSDN &quot;Do not call the Update method when using the SchemaXml  property to modify a field.&quot;</span>
&nbsp;
<span style="color: #008080; font-style: italic;">// Fetch the field again and apply the web-id</span>
var lookupFieldReFetch <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span>SPFieldLookup<span style="color: #008000;">&#41;</span>root<span style="color: #008000;">.</span><span style="color: #0000FF;">Fields</span><span style="color: #008000;">&#91;</span><span style="color: #666666;">&quot;MyLookupField&quot;</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
lookupFieldReFetch<span style="color: #008000;">.</span><span style="color: #0000FF;">LookupWebId</span> <span style="color: #008000;">=</span> myWeb<span style="color: #008000;">.</span><span style="color: #0000FF;">ID</span><span style="color: #008000;">;</span>
lookupFieldReFetch<span style="color: #008000;">.</span><span style="color: #0000FF;">LookupField</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;Title&quot;</span><span style="color: #008000;">;</span>
lookupFieldReFetch<span style="color: #008000;">.</span><span style="color: #0000FF;">Update</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p>This problem still persists in the beta of SharePoint 2010. I hope this will get fixed in the RTM. <a href="http://pholpar.wordpress.com/2010/01/26/updating-sharepoint-lookup-and-user-field-values/">Creating a lookup-field-connection</a> is far more easy by the way …</p>
]]></content:encoded>
			<wfw:commentRss>http://www.entwicklungsgedanken.de/2010/02/01/updating-existing-lookup-fields-in-sharepoint/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>With great power comes &#8211; PublishingWeb.DefaultPage</title>
		<link>http://www.entwicklungsgedanken.de/2009/10/30/with-great-power-comes-publishingweb-defaultpage/</link>
		<comments>http://www.entwicklungsgedanken.de/2009/10/30/with-great-power-comes-publishingweb-defaultpage/#comments</comments>
		<pubDate>Fri, 30 Oct 2009 10:28:00 +0000</pubDate>
		<dc:creator>Eric Bartels</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint-Development]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[publishing]]></category>
		<category><![CDATA[RunWithElevatedPrivileges]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.entwicklungsgedanken.de/2009/10/30/with-great-power-comes-publishingweb-defaultpage/</guid>
		<description><![CDATA[or at least the power of “Use Remote Interfaces &#8211; Use SOAP, Web DAV, or SharePoint Designer interfaces to access the Web site”. In a SharePoint project I’m working on it was necessary to get the default page of a publishing web in case where it differs from default.aspx. &#160; In the environment the project [...]]]></description>
			<content:encoded><![CDATA[<p>or at least the power of “<strong>Use Remote Interfaces &#8211; Use SOAP, Web DAV, or SharePoint Designer interfaces to access the Web site</strong>”.</p>
<p>In a SharePoint project I’m working on it was necessary to get the default page of a publishing web in case where it differs from <code>default.aspx</code>.    <br />&#160; <br />In the environment the project takes place the “normal SharePoint user” is not allowed to use the SharePoint Designer. The page itself can be fully viewed by these users but the following code throws a <code>SecurityException</code> due to the missing “Remote interface”-permission.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #008080; font-style: italic;">// ... web is instantiated and disposed of course!</span>
var pub <span style="color: #008000;">=</span> PublishingWeb<span style="color: #008000;">.</span><span style="color: #0000FF;">GetPublishingWeb</span><span style="color: #008000;">&#40;</span>web<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
var defaultPage <span style="color: #008000;">=</span> pub<span style="color: #008000;">.</span><span style="color: #0000FF;">DefaultPage</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #008080; font-style: italic;">// ....</span></pre></div></div>

<p>In order to work in my projects environment this peace of code needs to be wrapped inside a resource-expensive <code>SPSecurity.RunWithElevatedPrivileges</code>-delegate. Makes absolutely no sense to me&#8230;</p>
<p>SharePoint 2010 has a lot of improvements for the “publishing infrastructure”. Lets hope this is fixed, too.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.entwicklungsgedanken.de/2009/10/30/with-great-power-comes-publishingweb-defaultpage/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Server Type &#8220;complete&#8221; is missing when installing Office SharePoint Server 2007 on Windows 7 or Windows Vista</title>
		<link>http://www.entwicklungsgedanken.de/2009/08/25/server-type-complete-is-missing-when-installing-office-sharepoint-server-2007-on-windows-7-or-windows-vista/</link>
		<comments>http://www.entwicklungsgedanken.de/2009/08/25/server-type-complete-is-missing-when-installing-office-sharepoint-server-2007-on-windows-7-or-windows-vista/#comments</comments>
		<pubDate>Tue, 25 Aug 2009 19:52:55 +0000</pubDate>
		<dc:creator>Eric Bartels</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint-Development]]></category>
		<category><![CDATA[Farm]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[Missing]]></category>
		<category><![CDATA[MOSS]]></category>
		<category><![CDATA[Role]]></category>
		<category><![CDATA[Vista]]></category>
		<category><![CDATA[Windows 7]]></category>

		<guid isPermaLink="false">http://www.entwicklungsgedanken.de/?p=330</guid>
		<description><![CDATA[I really like Windows 7! As I am a SharePoint developer I was happy that (thanks to Bamboo) one can install SharePoint on Vista and Windows 7. After I figured out why my first installation try went wrong I hit another strange issue. When installing MOSS you have to choose which role your server is [...]]]></description>
			<content:encoded><![CDATA[<p>I really like Windows 7! As I am a SharePoint developer I was happy that (thanks to Bamboo) one can <a href="http://community.bamboosolutions.com/forums/t/13186.aspx#22419">install SharePoint on Vista and Windows 7</a>.</p>
<p>After <a href="http://community.bamboosolutions.com/forums/t/13186.aspx#22419">I figured out why my first installation try went wrong</a> I hit another strange issue.</p>
<p><a href="http://www.entwicklungsgedanken.de/wp-content/uploads/2009/08/Server-Type-Missing.png"><img src="http://www.entwicklungsgedanken.de/wp-content/uploads/2009/08/Server-Type-Missing-150x150.png" alt="Server-Type-Missing" title="Server-Type-Missing" width="150" height="150" class="alignright size-thumbnail wp-image-331" /></a>When installing MOSS you have to choose which role your server is in. As I want to develop with BDC, Excel Services, Search Service I need to create a small farm (SQL Server running on the same machine in this case). But during the setup the &#8220;Complete Server Type&#8221; was missing!</p>
<h3>Where are you my PDC?</h3>
<p>I like development. So this installation took place on my home-machine which is not inside a domain.
<p>A little while ago I installed MOSS successfully on Vista including the &#8220;complete role&#8221;. So one difference was the absence of a domain-controller &#8230;</p>
<h3>Conclusion</h3>
<p><strong>After my machine became a member of a domain (and a reboot) the &#8220;Complete Server Type Role&#8221; became available during installation!</strong> SharePoint development on Windows 7 x64 is pure fun &#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.entwicklungsgedanken.de/2009/08/25/server-type-complete-is-missing-when-installing-office-sharepoint-server-2007-on-windows-7-or-windows-vista/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Do not use DateTimeField when displaying the date of your field</title>
		<link>http://www.entwicklungsgedanken.de/2009/08/21/do-not-use-datetimefield-when-displaying-the-date-of-your-field/</link>
		<comments>http://www.entwicklungsgedanken.de/2009/08/21/do-not-use-datetimefield-when-displaying-the-date-of-your-field/#comments</comments>
		<pubDate>Fri, 21 Aug 2009 08:54:34 +0000</pubDate>
		<dc:creator>Eric Bartels</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint-Development]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[Control]]></category>
		<category><![CDATA[DateTime]]></category>

		<guid isPermaLink="false">http://www.entwicklungsgedanken.de/?p=326</guid>
		<description><![CDATA[I have a &#8220;DateTime-field&#8221; inside a list which contains both date and time. In order to allow the user to edit this information inside the publishing page I used the Microsoft.SharePoint.WebControls.DateTimeField. If you only want to display that field-value you can simply use the ControlMode-property and set it to Display. If you want to display [...]]]></description>
			<content:encoded><![CDATA[<p>I have a &#8220;DateTime-field&#8221; inside a list which contains both date and time. In order to allow the user to edit this information inside the publishing page I used the <code>Microsoft.SharePoint.WebControls.DateTimeField</code>.</p>
<p>If you only want to display that field-value you can simply use the <code>ControlMode-property</code> and set it to <code>Display</code>. If you want to display only the date-part of that datetime just set the <code>DateOnly-property</code> to <code>true</code>&#8230;</p>
<p>Thats the theory. If you do it like that you get a nice <code>Object reference not set to an instance of an object</code>-error. The cause is</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">DateTimeField<span style="color: #008000;">.</span><span style="color: #0000FF;">set_DateOnly</span></pre></div></div>

<p>Reflectoring the control reveals that when the control is in &#8220;DisplayMode&#8221; the inner <code>DateTimeControl</code> is not created and that is why <code>DateOnly</code> cannot be set.</p>
<p>Its seems this control was developed by a drunken programmer as <a href="http://www.coeamyd.net/PermaLink,guid,561b2b93-bfa5-4ad7-9805-d939b2b9301e.aspx">my friend stated out a bug in this control</a> a while ago.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.entwicklungsgedanken.de/2009/08/21/do-not-use-datetimefield-when-displaying-the-date-of-your-field/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>One reason for: &#8220;The crawler could not communicate with the server. Check that the server is available and that the firewall access is configured correctly..&#8221;</title>
		<link>http://www.entwicklungsgedanken.de/2009/07/17/one-reason-for-the-crawler-could-not-communicate-with-the-server-check-that-the-server-is-available-and-that-the-firewall-access-is-configured-correctly/</link>
		<comments>http://www.entwicklungsgedanken.de/2009/07/17/one-reason-for-the-crawler-could-not-communicate-with-the-server-check-that-the-server-is-available-and-that-the-firewall-access-is-configured-correctly/#comments</comments>
		<pubDate>Fri, 17 Jul 2009 02:38:19 +0000</pubDate>
		<dc:creator>Eric Bartels</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint-Development]]></category>
		<category><![CDATA[Communication]]></category>
		<category><![CDATA[Crawler]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[Search]]></category>

		<guid isPermaLink="false">http://www.entwicklungsgedanken.de/?p=298</guid>
		<description><![CDATA[Today the crawler of the search service of my MOSS-Development system stopped working from &#8220;one second to another&#8221;. The crawl-log showed me this error. The crawler could not communicate with the server. Check that the server is available and that the firewall access is configured correctly.. The start is essential I reconfigured everything, I checked [...]]]></description>
			<content:encoded><![CDATA[<p>Today the crawler of the search service of my MOSS-Development system stopped working from &#8220;one second to another&#8221;. The crawl-log showed me this error.<br />
<code>The crawler could not communicate with the server. Check that the server is available and that the firewall access is configured correctly..</code></p>
<h3>The start is essential</h3>
<p>I reconfigured everything, I checked the database-security, rebooted the virtual machine, re-created the content-sources. Nothing helped &#8230;</p>
<p>
After some digging I found out that the start page of that site-collection (<code>default.aspx</code>) throws an exception due to a faulty web part&#8230;<br />
This can&#8217;t be&#8230; Can it?! I removed the faulty web part from the <code>default.aspx</code> and the start page runs normal &#8230; and so does the crawler!
</p>
<p>
<strong>Because of an erroneous start page the whole crawling process for that site-collection is not working!</strong>
</p>
<h3>Conclusion</h3>
<p>Make sure that the &#8220;entrance&#8221; to your site-collections is wide open and totally working &#8230;</p>
<p>
PS:  Excluding the <code>default.aspx</code> via &#8220;Crawl rules&#8221; does not work. The crawler still stops.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.entwicklungsgedanken.de/2009/07/17/one-reason-for-the-crawler-could-not-communicate-with-the-server-check-that-the-server-is-available-and-that-the-firewall-access-is-configured-correctly/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Site-Definitions within SharePoint are useless!</title>
		<link>http://www.entwicklungsgedanken.de/2009/04/19/site-definitions-within-sharepoint-are-useless/</link>
		<comments>http://www.entwicklungsgedanken.de/2009/04/19/site-definitions-within-sharepoint-are-useless/#comments</comments>
		<pubDate>Sun, 19 Apr 2009 08:56:51 +0000</pubDate>
		<dc:creator>Eric Bartels</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint-Development]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[confusion]]></category>
		<category><![CDATA[Onet.xml]]></category>
		<category><![CDATA[Site-Definition]]></category>

		<guid isPermaLink="false">http://www.entwicklungsgedanken.de/?p=234</guid>
		<description><![CDATA[Last week I nearly fell of my chair I was sitting on. I found a kb article filed under http://support.microsoft.com/kb/898631/en-us. This articles describes what is supported and what is not supported regarding site definitions within SharePoint. We do not support modifying a custom site definition or a custom area definition after you create a new [...]]]></description>
			<content:encoded><![CDATA[<p>Last week I nearly fell of my chair I was sitting on. I found a kb article filed under <a href="http://support.microsoft.com/kb/898631/en-us">http://support.microsoft.com/kb/898631/en-us</a>. This articles describes what is supported and what is not supported regarding site definitions within SharePoint.</p>
<blockquote><p><span style="color: #888888;"><em>We do not support modifying a custom site definition or a custom area definition after you create a new site or a new portal area by using that site definition or area definition. Additionally, we do not support modifying the .xml files or the .aspx files in the custom site definition or in the custom area definition after you deploy the custom site definition or the custom area definition.</em></span></p></blockquote>
<p>So site definitions are a one way ticket. All your requirements (even future ones) must be implemented before you actually create sites based on your site definition! This is far from &#8220;real life&#8221;.</p>
<p>This &#8220;supported and unsupported-link&#8221; is not referenced within the SDK (MOSS or WSS). The SDK describes the nice way of creating site definitions, how to deploy them e cetera. Once deployed your site definition <strong>has to be immutable</strong>! But this fact is not mentioned inside the SDK!<br />
Even more confusion is spread when you want to lock down SharePoint Designer (which is now available for free) following Microsoft&#8217;s kb article filed under <a href="http://support.microsoft.com/kb/940958/en-us">http://support.microsoft.com/kb/940958/en-us</a>. If you read the article you will see that it suggests to modify the existing onet.xml files so that the changes <strong>also affects already provisioned sites</strong>.</p>
<p>Microsoft tells us that changing the site definition after sites have been provisioned with it is unsupported but on the other hand writes a kb article where site definitions should be modified to reflect changes to already provisioned sites! Another example of how difficult communication is!</p>
<h3>Conclusion</h3>
<p>SharePoint is a static environment when you rely on the &#8220;xml-ways&#8221; of customizing SharePoint. This issue also appears when using Content Types. Once a Content Type is deployed Microsoft &#8220;does not support&#8221; changes in the Content Type xml-definition.</p>
<p>What gets clear when reading the kb article (<a href="http://support.microsoft.com/kb/898631/en-us">http://support.microsoft.com/kb/898631/en-us</a>) is that changing/updating via code is always supported. Perhaps its time to move away from the xml-based declarative approach to the code-based approach.</p>
<p>Lets hope <a href="http://blogs.msdn.com/sharepoint/archive/2009/04/14/microsoft-sharepoint-14-is-now-microsoft-sharepoint-2010.aspx">SharePoint 2010</a> will fix all these issues!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.entwicklungsgedanken.de/2009/04/19/site-definitions-within-sharepoint-are-useless/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

