Configuration access
You can access organization configuration using the Settings property of the ProjectContext. Settings holds an instance of IProjectSettingsStore.
Configuration settings are organized into groups. In order to access a setting you need the group name and the key within that group. For example, to check if SAP-based validation for PO numbers is activated, you would request ValidateFromSAP from the PON group.
In most cases you have to access simple settings. These settings must be one of the following types.
-
string*
-
boolean*
-
double
-
int*
-
long
-
byte
-
char
*Kofax AP Agility mostly uses string, bool and int settings. The other settings are rarely used.
It is recommended that you use one of the convenience methods to access simple properties. For example,
-
string GetStringSetting(string groupName, string keyName, string defaultValue = null)
-
bool GetBooleanSetting(string groupName, string keyName, bool defaultValue)
-
int GetIntSetting(string groupName, string keyName, int defaultValue)
The default value is returned if the requested setting does not exist.
In rare cases you might need to access dictionary settings. Use the following syntax.
IDictionary<string,ISettingSimple> GetDictionarySetting(string groupName, string keyName)
A dictionary contains further setting that are accessible by keys.
For example, to get the connection string for the SQL connection group 1, you need to call:
string connectionString =
settings.
GetDictionarySetting(“SQL”,”CONNECTIONSTRING”)[“1”].
GetStringValue();