Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a feature. This gets compiled into a WSP package, and installed on a particular SharePoint server. So far very standard.

But - the feature deploys a custom timer job. The custom timer job needs to connect to a SQL database (this requires a connection string).

So enter into the scene a property - the connection string. This can change depending on which server the WP package gets installed.

Primarily I need a way to customize the wsp package / or feature.

I doubt that its possible to provide a configuration model with a wsp, so is it maybe possible to have properties on features that can be maintained using standard SharePoint functionality?

share|improve this question

4 Answers 4

up vote 4 down vote accepted

You can specify the properties element in your feature.xml file, which can then be accessd from the feature receiver as indicated by Thomson. But this approach will land you to the problem of compiling your WSP again and again as you change the feature.xml properties.

I would suggest you to maintain any configuration in a SharePoint list. Your feature once activated can then read these values in the code behind. You can use the ConfigStote available on codeplex for maintaining any configurations.

http://spconfigstore.codeplex.com/

share|improve this answer

I second storing the config string in the list, or, if you're comfortable with development, what I've done in the past was add a configuration page for my timer job to central admin, and store the connection string for that job in the SPWebApplication.Properties hashtable.

We did things that way because we wanted our settings stored in a place which wasn't easily shown through the UI - you hardly want a list with your database login in plain text. And, actually, adding a page to central admin for that was pretty straight forward.

share|improve this answer

There's also the Application Setting Manager provided by the MS SharePoint Guidance patterns & practices library. I would review the "When Should I Use" article to start. Also due to its higher learning curve than some of the other solutions here, I'd probably only use it if there were other parts of the p&p library I wanted to take advantage of.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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