The approach shown below is only compatible with version 2.0 (and higher) of the Vault Application Framework, where the target audience runs M-Files 2018 or higher. If using version 1.0, or to maintain compatibility with M-Files 2015.3 and lower, configuration attributes should be used instead.
M-Files 2018 introduces a new section within the M-Files Admin software that collates a variety of customisable configuration options from across the M-Files vault, including:
- Metadata card configuration
- Federated Authentication configuration
- Intelligent Metadata Layer component (e.g. External Repository Connector and Intelligence Service) configuration
The 2.0 release of the Vault Application Framework enables developers to expose the configuration of their Vault Application Framework applications into this same section.
Inheriting from the new base class
Using the VAF 2.1 base class will alter the Named Value Storage location used for configuration, therefore any existing configuration will be lost. You should ensure that users are aware of the correct way to migrate their configuration from VAF 2.0 applications to VAF 2.1 applications.
Version 2.1 of the Vault Application Framework continues to support the VAF 2.0 configuration approach approach, but adds in a base class that allows easy extension of the standard functionality. In order to support newer items such as the [Security] attribute, you must change your implementation to use the newer approach. A sample on how to convert a VAF 2.0 application to VAF 2.1 is also available.
By default the configuration will be visible to vault administrators and system administrators, but only be editable by system administrators. When running on the M-Files cloud this means that vault administrators can view, but not change, the configuration. More information on using the [Security] attribute can be found on its dedicated page.
To do this you must inherit from
ConfigurableVaultApplicationBase<T>, instead of the older
VaultApplicationBase class. Common functionality such as implementing a custom dashboard can be implemented by overriding methods in the base class.
In the example above there has been a
Configuration class defined elsewhere in the project. By inheriting from this base class, a configuration node will be added to the M-Files Admin
Other Applications configuration section. The “Configuration” properties are driven from the properties on the Configuration class, as detailed on the dedicated page.
Ensure that your vault application implements
MFiles.VAF.AdminConfigurations.IUsesAdminConfigurations. This will require you to declare one method -
InitializeAdminConfigurations - as shown below.
Registering configuration nodes
InitializeAdminConfigurations method allows a developer to add configuration nodes into the M-Files Admin configuration screen, and for these configuration nodes to be rendered within the M-Files Admin.
In the sample below we declare a custom configuration class named
Configuration, which must be marked with the
[DataContract] attribute from
System.Runtime.Serialization. All fields and properties of this class that are marked with the
[DataMember] attribute will be shown within the M-Files Admin interface, as shown in the screenshot below.
Reacting when configuration changes
The configuration can be automatically updated when changes are saved within the M-Files 2018 Admin interface
ConfigurationNode<T> returned from the call to
AddSimpleConfigurationNode will raise a
Changed event when the configuration within the M-Files Admin is altered. This allows your application to reflect an updated configuration without requiring a vault restart: