Feature request: write API

Dec 21, 2009 at 2:52 PM

Hi,

Thanks for Config Store. It is a nice contribution to our SharePoint tool belt.

What I am missing is an API to write to the config store. This is useful in a feature activation receiver, in order to provision the default configuration keys and values.

I know one can fill a list through the feature defintion, but this capability is the cause of some headache as each feature activation re-adds the data.

Regards,

Jean-Marie

Coordinator
Dec 21, 2009 at 9:07 PM

Agreed - the Config Store should have methods to actually write into the list. I'll add this to a future version, thanks for the request.

As an FYI, here are a couple of ways I've seen the 'default values problem' dealt with:

  • Store the default values in an XML file using a certain schema. Write some code to load all the values into the list using SPWeb.ProcessBatchData() - see here for some info on this
  • Have a 'master' instance of the Config Store list in dev. Use my Content Deployment Wizard utility to update other Config Store instances (e.g. test, staging, production) 

Thanks again,

Chris.

Dec 23, 2009 at 7:28 AM

Thank you for the suggestions (and I didn't know ProcessBatchData).

More specifically, my need is to set an item of the config store if it is not present, which should be at feature activation time or later if a user mistakenly erases an entry.

The production environment of my customer is not accessible from other environments.

Currently, I try to read a config value and if the InvalidConfigException exception is raised, I write to the list.

By the way, an API method like IsValuePresent would be great.

Regards,

Jean-Marie