2

I am creating some features in SharePoint 2010. I need to have some settings for all the features that I intend to keep in a xml file that should get deployed to 14 hive. On feature activation, settings should be read from the xml file. How can I have a common xml file for all my features and how to read it back from 14 hive.

2 Answers 2

1

You can use properties element in the feature schema. It allows you to store config information in the form of key value pair. Here is a article that describes it usage. Also you can always use resource file (see here), but I guess properties element of feature schema would be better way to do it.

1
  • Well then again it would need re compiling and re deployment if I need to change the values.
    – V.B
    Jun 19, 2012 at 7:12
3

Sharepoint includes a hierarchical configuration manager that can safely store and retrieve configuration settings. You can use sharepoint property bags to store/retrieve config settings.

SharePoint 2010 does not provide a user interface to read and write these configuration settings at run time. To do this, you can use the property bag editor on CodePlex: codeplex

3
  • + 1. Sorry I didn't read your reply before posting mine. But I have added some comments Jun 19, 2012 at 7:17
  • 1
    I wouldn't recommend you to use Property key in Feature.xml because every time you change values for Property key, you will have to re-deploy the Feature. I would recommend you using the property bags at SPWeb/SPSite/SPWebApplication Level Jun 19, 2012 at 7:17

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.