I have a requirement where a custom action is only added to the root site of the site collection. So planning to add two features one Site scoped and the other Web scoped. In the event receiver of a Site scoped feature, I'm activating the Web scope feature.

For this i can use


How can I find the web level features feature id programmatically ?

  • I have edited the question to be more clear. If anything else come to mind, feel free to improve it and add more info as required. For example, do you have any restriction about the feature you are using?
    – SPArcheon
    Oct 28, 2014 at 14:53

1 Answer 1


Well. It really depends on which feature you have to activate.

The id of a feature does not change during its life. This means that if you can find out the id you will be sure it stays the same, regardless of the specific SharePoint farm instance. That said, you can "hardcode" your ID in a support class, much like SharePoint does with fields id in the SPBuiltInFields class.

If for any reason you can't know the feature ID beforehand you will need some other way to identify the feature - for example the display name. With that info you can use the FeatureDefinitions property of the SPWeb object to browse the installed 'Web' level features, search the one you need and add it to the Features collection to activate it as required.

  • I used the featureID from feature Properties in Visual Studio and activated the feature in the code. Many Thanks !
    – Shaamil
    Oct 30, 2014 at 9:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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