<?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; feature</title>
	<atom:link href="http://www.entwicklungsgedanken.de/tag/feature/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>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>Inconvenient class-naming with feature receiver and scope=&#8221;Farm&#8221;</title>
		<link>http://www.entwicklungsgedanken.de/2008/12/11/inconvenient-class-naming-with-feature-receiver-and-scopefarm/</link>
		<comments>http://www.entwicklungsgedanken.de/2008/12/11/inconvenient-class-naming-with-feature-receiver-and-scopefarm/#comments</comments>
		<pubDate>Thu, 11 Dec 2008 00:36:20 +0000</pubDate>
		<dc:creator>Eric Bartels</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint-Development]]></category>
		<category><![CDATA[Farm]]></category>
		<category><![CDATA[feature]]></category>
		<category><![CDATA[Inconvenient]]></category>
		<category><![CDATA[Receiver]]></category>
		<category><![CDATA[Scope]]></category>

		<guid isPermaLink="false">http://www.entwicklungsgedanken.de/?p=127</guid>
		<description><![CDATA[Writing feature receivers during SharePoint customizing a common task. Depending on the scope your features belongs to your code looks similar to the following: public override void FeatureActivated&#40;SPFeatureReceiverProperties properties&#41; &#123; // Scope=&#34;Web&#34; SPWeb web = properties.Feature.Parent as SPWeb; &#160; // Scope=&#34;Site&#34; SPSite site = properties.Feature.Parent as SPSite; &#160; // Scope=&#34;WebApplication&#34; SPWebApplication app = properties.Feature.Parent as [...]]]></description>
			<content:encoded><![CDATA[<p>Writing feature receivers during SharePoint customizing a common task. Depending on the scope your features belongs to your code looks similar to the following:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">override</span> <span style="color: #6666cc; font-weight: bold;">void</span> FeatureActivated<span style="color: #008000;">&#40;</span>SPFeatureReceiverProperties properties<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
  <span style="color: #008080; font-style: italic;">// Scope=&quot;Web&quot;</span>
  SPWeb web <span style="color: #008000;">=</span> properties<span style="color: #008000;">.</span><span style="color: #0000FF;">Feature</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Parent</span> <span style="color: #0600FF; font-weight: bold;">as</span> SPWeb<span style="color: #008000;">;</span>
&nbsp;
  <span style="color: #008080; font-style: italic;">// Scope=&quot;Site&quot;</span>
  SPSite site <span style="color: #008000;">=</span> properties<span style="color: #008000;">.</span><span style="color: #0000FF;">Feature</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Parent</span> <span style="color: #0600FF; font-weight: bold;">as</span> SPSite<span style="color: #008000;">;</span>
&nbsp;
  <span style="color: #008080; font-style: italic;">// Scope=&quot;WebApplication&quot;</span>
  SPWebApplication app <span style="color: #008000;">=</span> properties<span style="color: #008000;">.</span><span style="color: #0000FF;">Feature</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Parent</span> <span style="color: #0600FF; font-weight: bold;">as</span> SPWebApplication<span style="color: #008000;">;</span>
&nbsp;
  <span style="color: #008080; font-style: italic;">// Scope=&quot;Farm&quot;. Does not work</span>
  SPFarm farm <span style="color: #008000;">=</span> properties<span style="color: #008000;">.</span><span style="color: #0000FF;">Feature</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Parent</span> <span style="color: #0600FF; font-weight: bold;">as</span> SPFarm<span style="color: #008000;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<h3>Farm != SPFarm</h3>
<p>So the last line in the example code does not work. The variables <code>farm</code> is always <code>null</code>.</p>
<p>Here comes the great &#8220;<strong>SharePoint-naming-convention</strong>&#8220;&#8230; The class to get a farm-context is named <code>SPWebService</code>!</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">override</span> <span style="color: #6666cc; font-weight: bold;">void</span> FeatureActivated<span style="color: #008000;">&#40;</span>SPFeatureReceiverProperties properties<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
  <span style="color: #008080; font-style: italic;">// Scope=&quot;Farm&quot;. Works!</span>
  SPWebService farm <span style="color: #008000;">=</span> properties<span style="color: #008000;">.</span><span style="color: #0000FF;">Feature</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Parent</span> <span style="color: #0600FF; font-weight: bold;">as</span> SPWebService<span style="color: #008000;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.entwicklungsgedanken.de/2008/12/11/inconvenient-class-naming-with-feature-receiver-and-scopefarm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting the MasterPage during feature activation sometimes works but not always?</title>
		<link>http://www.entwicklungsgedanken.de/2008/07/23/setting-the-masterpage-during-feature-activation-sometimes-works-but-not-always/</link>
		<comments>http://www.entwicklungsgedanken.de/2008/07/23/setting-the-masterpage-during-feature-activation-sometimes-works-but-not-always/#comments</comments>
		<pubDate>Wed, 23 Jul 2008 11:53:08 +0000</pubDate>
		<dc:creator>Eric Bartels</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint-Development]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[feature]]></category>
		<category><![CDATA[masterpage]]></category>

		<guid isPermaLink="false">http://www.entwicklungsgedanken.de/?p=57</guid>
		<description><![CDATA[One of my current projects had the requirement to modify certain properties of the SharePoint &#8220;Look and feel&#8221;. To make updates and improvements easy I created a custom masterpage which is provisioned via a Feature. A custom feature receiver takes care of setting the masterpage and a feature staple takes care of newly created webs. [...]]]></description>
			<content:encoded><![CDATA[<p>
One of my current projects had the requirement to modify certain properties of the SharePoint &#8220;Look and feel&#8221;.</p>
<p>
To make updates and improvements easy I created a custom masterpage which is provisioned via a Feature. A custom feature receiver takes care of setting the masterpage and a feature staple takes care of newly created webs.
</p>
<h3>Strange things</h3>
<p>
This works well &#8230; Well mostly. In some existing webs my custom masterpage is simply not attached.
</p>
<h3>Solution</h3>
<p>If you set the <code>SPWeb.MasterUrl</code> do not forget to set the <code>SPWeb.CustomMasterUrl</code>, too!</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #008080; font-style: italic;">// web = SPWeb</span>
web<span style="color: #008000;">.</span><span style="color: #0000FF;">MasterUrl</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;myPath/to/my.master&quot;</span><span style="color: #008000;">;</span>
web<span style="color: #008000;">.</span><span style="color: #0000FF;">CustomMasterUrl</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;myPath/to/my.master&quot;</span><span style="color: #008000;">;</span></pre></div></div>

<p>
Now my masterpage is attached and used as desired.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.entwicklungsgedanken.de/2008/07/23/setting-the-masterpage-during-feature-activation-sometimes-works-but-not-always/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

