Custom Sitecore Configuration Files

Here is a brief walkthrough on how to setup a custom configuation file for Sitecore and how to access it programmatically.

In this example it is part of a custom Workflow Workbox module for Sitecore.

First you will need a Sitecore patch file: https://gist.github.com/blacktambourine/f504079434e300fbca6d


 You will then need a c# class for this config:

https://gist.github.com/blacktambourine/1667ff7abf5ec3b8649b


Things to note:

- The parameters of the constructor of this class are the tags in your config file.

- The config file attribute hint=“raw:AddWorkboxPlusItemTemplateName” is used to specify a method in your class that will map this XML Node to a C# object.

To access this config programmatically you need to call the Sitecore.Configuration.Factory:

WorkboxPlusConfig WorkboxPlusConfigSettings = Sitecore.Configuration.Factory.CreateObject(“WorkboxPlus/configuration”, true) as WorkboxPlusConfig;