Read configuration of a VAF and Metadata Card

Hi, we are working on a VAF that can report various information like users and sizes of vaults to a documentation vault. Now we would like to also save VAF configs and the Metadata Card config to a vault as objects.
We found that the new M-Files Property Calculator VAF can save its config with "Configuration History".
We would like to know how this is done and if we possibly could read configs from other VAFs or even vaults.
The LoadConfiguration Method of VaultConfigurationDomainOperations looks like a starting point.

Parents
  • You're on the right track.  You work for a partner?  If so then take a look at page 19 on this document: GPC 2023 - Developer Track content.pdf

  • I managed to implement the feature. Here's a code snippet for other developers who want to do the same:

    //MFiles.VAF.Configuration.Domain.Client.VaultConfigurationDomainOperations
    var confOps = new VaultConfigurationDomainOperations(vault);
    
    //Read AVS
    ConfigurationDomain avs = confOps.GetAdvancedVaultSettingsDomain();
    string avsConfJson = confOps.LoadConfiguration(avs);
    //var avsConf = JObject.Parse(avsConfJson);
    
    ReportConfig(vault, Configuration.ConfigHistory.AVSTitle, avsConfJson);
    
    //Read MetadataCardConfiguration
    ConfigurationDomain mdcConfigDomain = confOps.GetMetadataCardConfigurationDomain();
    string mdcConfJson = confOps.LoadConfiguration(mdcConfigDomain);
    
    ReportConfig(vault, Configuration.ConfigHistory.MCCTitle, mdcConfJson);
    
    //Read VAF configs
    var configDomains = confOps.GetRegisteredConfigurationDomains(ConfigurationDomainType.Other);
    
    //https://developer.m-files.com/Frameworks/Vault-Application-Framework/Reference/html/456c4708-b5c6-b8fe-2598-920c58a93de8.htm
    
    foreach (ConfigurationDomain vafConfigDomain in configDomains)
    {
        if (vafConfigDomain.Configuration != null)
        {
            string vafConfJson = confOps.LoadConfiguration(vafConfigDomain);
            string title = Configuration.ConfigHistory.ConfigTitlePrefix + vafConfigDomain.DisplayName;
            ReportConfig(vault, title, vafConfJson);
        }
        if (vafConfigDomain.SubDomains != null)
        {
            var subDomains = vafConfigDomain.SubDomains.TypedValue;
            foreach (var subDomain in subDomains)
            {
                if (subDomain.TypedValue.Configuration != null)
                { 
                    string vafConfJson = confOps.LoadConfiguration(subDomain.TypedValue);
                    string title = Configuration.ConfigHistory.ConfigTitlePrefix + vafConfigDomain.DisplayName + "." + subDomain.TypedValue.DisplayName;
                    ReportConfig(vault, title, vafConfJson);
                }
            }
        }
    }

Reply
  • I managed to implement the feature. Here's a code snippet for other developers who want to do the same:

    //MFiles.VAF.Configuration.Domain.Client.VaultConfigurationDomainOperations
    var confOps = new VaultConfigurationDomainOperations(vault);
    
    //Read AVS
    ConfigurationDomain avs = confOps.GetAdvancedVaultSettingsDomain();
    string avsConfJson = confOps.LoadConfiguration(avs);
    //var avsConf = JObject.Parse(avsConfJson);
    
    ReportConfig(vault, Configuration.ConfigHistory.AVSTitle, avsConfJson);
    
    //Read MetadataCardConfiguration
    ConfigurationDomain mdcConfigDomain = confOps.GetMetadataCardConfigurationDomain();
    string mdcConfJson = confOps.LoadConfiguration(mdcConfigDomain);
    
    ReportConfig(vault, Configuration.ConfigHistory.MCCTitle, mdcConfJson);
    
    //Read VAF configs
    var configDomains = confOps.GetRegisteredConfigurationDomains(ConfigurationDomainType.Other);
    
    //https://developer.m-files.com/Frameworks/Vault-Application-Framework/Reference/html/456c4708-b5c6-b8fe-2598-920c58a93de8.htm
    
    foreach (ConfigurationDomain vafConfigDomain in configDomains)
    {
        if (vafConfigDomain.Configuration != null)
        {
            string vafConfJson = confOps.LoadConfiguration(vafConfigDomain);
            string title = Configuration.ConfigHistory.ConfigTitlePrefix + vafConfigDomain.DisplayName;
            ReportConfig(vault, title, vafConfJson);
        }
        if (vafConfigDomain.SubDomains != null)
        {
            var subDomains = vafConfigDomain.SubDomains.TypedValue;
            foreach (var subDomain in subDomains)
            {
                if (subDomain.TypedValue.Configuration != null)
                { 
                    string vafConfJson = confOps.LoadConfiguration(subDomain.TypedValue);
                    string title = Configuration.ConfigHistory.ConfigTitlePrefix + vafConfigDomain.DisplayName + "." + subDomain.TypedValue.DisplayName;
                    ReportConfig(vault, title, vafConfJson);
                }
            }
        }
    }

Children
No Data