Changes to SharePoint web.config with SharePoint API

App Development

Changes to SharePoint web.config with SharePoint API

Changes to SharePoint web.config with SharePoint API

When installing SharePoint solutions in production environments, configuration often leads to assorted complications. Making installation manuals for non-technical customers, adding configuration parameters to the web.config file, or adding any necessary configuration of third-party components by hand, are things that can be avoided by managing the configuration matters within the solution to be delivered without requiring any manual configuration, all through SharePoint API.

This can be accomplished with a feature with farm scope, which is responsible for changing settings in the web.config. This feature should have FeatureActivated and FeatureDeactivating event receivers in order to add / remove configuration values to the web.config all through SharePoint API.

Then we should create a feature dependency between the configuration feature and the rest of the features in the solution, so that they cannot be activated before activating the farm scoped feature which is the one that provides the necessary configuration (adding it to the web.config) for your solution to work.

Here’s an example event receiver:

 

Thanks for reading!

Federico Rodriguez

Rodrigo Pintos

Rodrigo Pintos

I’m Rodrigo, a software developer with +5 years of experience creating web and mobile applications. In the last years, I have focused on cross-platform mobile development working with several frameworks, such as Xamarin. For me, it's very important to build high-quality product by getting involved in the entire process, from designing till coding the application.

Leave a Reply

Thanks for signing up!

Stay Connected

Receive great content about building successful products!