Enable-SPFeature does not trigger the feature receiver

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 “access denied” error. I did […]

Inconvenient class-naming with feature receiver and scope=”Farm”

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(SPFeatureReceiverProperties properties) { // Scope="Web" SPWeb web = properties.Feature.Parent as SPWeb;   // Scope="Site" SPSite site = properties.Feature.Parent as SPSite;   // Scope="WebApplication" SPWebApplication app = properties.Feature.Parent as […]

Setting the MasterPage during feature activation sometimes works but not always?

One of my current projects had the requirement to modify certain properties of the SharePoint “Look and feel”. 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. […]