I created a feature and i want to staple it to the Team Site template. Unfortunately stapling doesn't work when the feature is set to the Site scope.
Also I'm using feature event receiver with the following code:
SPWeb site = properties.Feature.Parent as SPWeb; // Enable Management of Content Types for Proposals Library SPList listProposalLibrary = site.Lists["Proposals"]; listProposalLibrary.ContentTypesEnabled = true; listProposalLibrary.Update();
This line throws an error if scope=Site:
SPWeb site = properties.Feature.Parent as SPWeb;
I need to staple feature to the web scope and have the same functionality from source code. How could I solve this problem?