Accessing and Updating System Settings via Settings.xml
  • 13 Aug 2021
  • 1 Minute to read
  • Dark
    Light

Accessing and Updating System Settings via Settings.xml

  • Dark
    Light

Overview

The system settings can be accessed from the Settings.xml file which is located on a local installation of Decisions at C:\Program Files\Decisions\Decisions Server. The values of this file can be accessed and updated from an XML editor or via code.

Example

The following example will demonstrate how to access and update the DefaultAccountEmailAddress setting via code. 

  1. In a new C# project in any desired IDE, add a reference to DecisionsFramework.dll and add using DecisionsFramework.ServiceLayer;
  2. To access the DefaultAcocuntEmailAddress setting, add Settings.GetSettings().DefaultAccountEmailAddress. Add the following lines to update and save the changes to the setting.
    Settings.GetSettings().DefaultAccountEmailAddress =  "Updated@decisions.com";
    Settings.SaveSettings();


Below is a complete code example on how to access and update/save various settings from in the settings file in a console application.

 using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DecisionsFramework.ServiceLayer;
 
namespace DecisionsSampleAccessingSystemSettingsXML
{
    class AccessingSettingsXMLExample
    {
        static void Main(string[] args)
        {
 
            Console.WriteLine("LogFileMaxSize: " + Settings.GetSettings().LogFileMaxSize);
            Console.WriteLine("Bypass SMTP Server: " + Settings.GetSettings().Mail.ByPassSmtpServer);
            Console.WriteLine("Default Account Email Address: " + Settings.GetSettings().DefaultAccountEmailAddress);
            Console.WriteLine("Changing default account email address...");
            Settings.GetSettings().DefaultAccountEmailAddress = "Updated@decisions.com";
            Settings.SaveSettings();
            Console.WriteLine("Default Account Email Address: " + Settings.GetSettings().DefaultAccountEmailAddress);
 
            Console.ReadLine();
        }
    }
}

The output of the above code will be the following:

 LogFileMaxSize: 10485760
Bypass SMTP Server: True
Default Account Email Address: admin@decisions.com
Changing default account email address...
Default Account Email Address: Updated@decisions.com

Was this article helpful?

What's Next