Tuesday, 1 May 2012

Storing Application Level Setting

Problem: In a large On Premise farm holding several web applications (web app) I have multiple custom coded applications per web app.

Initial Hypothesis:

Storing the custom apps config settings in the web config is at the wrong level and dangerous to modify even using SharePoint features.

Using a list is an option however configuration could span site collections. Additionally, security would need to be set and access granted to the appropriate people on the config list - still me favourite option especially when adding caching.

I have also use property bags but have need to maintain this via PowerShell. A lot of developers like this option but without UI I felt it was not worth the effort to use/maintain and document this over using web.configs.

Resolution:
The CodePlex project "SharePoint Property Bag Setting 2010" (PBS2010) is a great tool for replacing the developers technique of using the web.config. The package is deployed at farm level and administration screens are provided on the Central Administration site for the farm. PBS2010 can be extended to allow Site Collection administrators to edit the settings themselves but if this is required I would use a configuration list at the root SPWeb for the Site collection. This is a nice codeplex project that I will definitely leverage going forward.

Update 2015-12-15: You can also append the url and view the RSS feed to see property bag values
http://me.demo.dev/sites/PaulBeck/_api/web/allproperties

Also See:
Microsoft have a very nice code block for setting and getting property bag settings.http://msdn.microsoft.com/en-us/library/ff798340.aspx
It uses a unique naming convention which I'm not too happy with but I guess it so dev's don't accidentally modify or delete property bag setting set by the product.