Config file for SharePoint custom timer jobs
SharePoint timer jobs run under the OWSTIMER.exe process.
This process has a configuration file associated with it. We can use this config file to specify the configuration settings that are to be used in custom timer jobs.
Open the OWSTIMER.EXE.CONFIG and add the <appSettings> tag to it.
Then add your key value pairs under this appSettings tag
For this you have to add a reference to System.Configuration
Then you can use the System.Configuration.ConfigurationManager.AppSettings[key] to retrieve the values for a key from the config file.
Example: string dept = System.Configuration.ConfigurationManager.AppSettings["Department"];
This process has a configuration file associated with it. We can use this config file to specify the configuration settings that are to be used in custom timer jobs.
Open the OWSTIMER.EXE.CONFIG and add the <appSettings> tag to it.
Then add your key value pairs under this appSettings tag
For this you have to add a reference to System.Configuration
Then you can use the System.Configuration.ConfigurationManager.AppSettings[key] to retrieve the values for a key from the config file.
Example: string dept = System.Configuration.ConfigurationManager.AppSettings["Department"];
It was helphful for me. Make sure everyone keeps the file name in uppercase.
ReplyDeleteThanks man, nice post!
ReplyDeleteYou're genius!
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteMay i know where the xml file will reside in file system -- Gans
ReplyDelete