3

Is it possible to turn off a feature using featuring stapling? How could you turn a feature off for all new sites that are created by default?

Edit

I have a feature staple to turn on publishing on each site. I want to turn off Wiki Page Home Page so that when you go to add a page the wiki page is not the default.

6

Don't think it is possible (anyone, fell free to correct me). But you can always do the opposite - staple a custom feature and deactivate the target features from the custom feature event receiver.

| improve this answer | |
3

It depends. Normally you can just set the ActivateOnDefault=False in the feauture. Otherwise you can add an EventReceiver containing code to "turn off" the feature(s) you want.

You do this by opening your solution in Visual Studio > right click on the solutions top-level > Add new item > Event Receiver <-- By this stage a dialog will open in which you choose on what occation this EventReceiver should trigger and what phase of an event you want to manipulate, in this case the "Web Provisioned" phase. It then generates an EventReceiver in which a WebProvisioning method will be available to modify for your needs.

I hope this helps.

| improve this answer | |
2

You can remove the feature reference in onet.xml

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.