Sharepoint Timer Job configuration

14/05/2015 14:43

Option configuration file OWSTIMER.EXE.CONFIG


1. Open OWSTIMER.EXE.CONFIG file in C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\BIN
2. Add appSettings node to configuration node
3. Modify your code, add reference to System.Configuration.dll and use call

 string connectionString = System.Configuration.ConfigurationManager.AppSettings["ProjectServerConnectionString"];
 string productionSiteUrl = System.Configuration.ConfigurationManager.AppSettings["TargetSiteUrl"];
 
4. Remember you have to restart OWSTIMER job by each change of config file

 
OWSTIMER.EXE.CONFIG file example

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0.30319" />
  </startup>
  <runtime>
    <NetFx40_LegacySecurityPolicy enabled="true" />
    <appDomainManagerAssembly value="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
    <appDomainManagerType value="Microsoft.SharePoint.SPAppDomainManager" />
 
  </runtime>
 <appSettings>
    <add key="ProjectServerConnectionString" value ="Data Source=yourserver;Initial Catalog=yourDbName;Integrated Security=true;"></add>
    <add key="TargetSiteUrl" value ="yourSitecollectionvalue"></add>
   </appSettings>
</configuration>