Vault Application

Hello,

We are developing an M-Files application that needs to include:

  • A Vault Application Framework 22.12 server component (C# class VaultApplication : ConfigurableVaultApplicationBase<T>), and
  • A User Interface Extensibility Framework client component (ShellUI module with right-pane dashboards and custom commands).

We would like to deploy this as a single application package.

We attempted to merge the two by updating appdef.xml like this:

 

<application type="both" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

             xsi:noNamespaceSchemaLocation="http://www.m-files.com/schemas/appdef-Server-v5.xsd">

  <guid>eb1ec555-b326-46df-899b-8ece191a08bd</guid>

  <name>My Company</name>

  <version>1.0</version>

  <required-mfiles-version>22.3.0.0</required-mfiles-version>

 

  <extension-objects>

    <extension-object>

      <name>GCG.Vault.Hybrid</name>

      <assembly>GCG.Vault.Hybrid.dll</assembly>

      <class>GCG.Vault.Hybrid.VaultApplication</class>

      <installation-method>Install</installation-method>

      <uninstallation-method>Uninstall</uninstallation-method>

      <initialization-method>Initialize</initialization-method>

      <uninitialization-method>Uninitialize</uninitialization-method>

      <start-operations-method>StartOperations</start-operations-method>

    </extension-object>

  </extension-objects>

 

  <modules>

    <module environment="shellui" fast-browsing-compatible="true">

      <file>Client/main.js</file>

    </module>

  </modules>

 

  <dashboards>

    <dashboard id="eforms-dashboard">

      <content>Client/eforms.html</content>

      <allow-selection>true</allow-selection>

    </dashboard>

  </dashboards>

</application>

 

 

We tried appdef-Server-v5.xsd as well as appdef -v5.xsd

 

When we install this application:

  • If we use appdef-server-v5.xsd, the server component loads, but the dashboard never appears.
  • If we use appdef-v5.xsd with type="both", I get an error:

The structure of the application is invalid. (Unrecognized application definition schema or application structure.)

 

So, my questions are:

  1. Does M-Files 22.12 fully support hybrid applications (type="both") with both server extension objects and client dashboards?
  2. Which schema (appdef-server-v5.xsd or appdef-v5.xsd) is correct for hybrid apps?
  3. Is there an official example or template for packaging Vault Application Framework + UIX into one app?

We have installed M-Files extension for VS-2022

Parents Reply Children
  • Hi  , followed the example in provided link UIX to Server but trying multiple tries ending up with the error saying "TypeError: shellFrame.ShellUI.Vault.Async.ExtensionMethodOperations.ExecuteVaultExtensionMethod is not a function"

    the below server method is never reached


    [VaultExtensionMethod("VaultExtensionMethod_VAF", RequiredVaultAccess = MFVaultAccess.MFVaultAccessNone)]
    private string TestVaultExtensionMethod(EventHandlerEnvironment env)
    {
    SysUtils.ReportInfoToEventLog("Reached to server");
    return DateTime.Now.ToLongTimeString()
    + " (the input received from client was: " + env.Input
    + ")";
    }

    client method i called as per website example

    shellFrame.ShellUI.Vault.Async.ExtensionMethodOperations.ExecuteVaultExtensionMethod(
    "VaultExtensionMethod_VAF", // The name of the extension method to execute.
    "world", // The input (string) to pass it.
    function (response) {
    // The output (string) will be in response; show it.
    MFiles["ShowToast"](response);
    });

    even i tried 

    shellFrame.ShellUI.Vault.ExtensionMethodOperations.ExecuteVaultExtensionMethod(
    "VaultExtensionMethod_VAF", // The name of the extension method to execute.
    "world")}

  • Hi  , The difference i see is that example is xsi:noNamespaceSchemaLocation="www.m-files.com/.../appdef-server-v1.xsd" whereas we are using 

    xsi:noNamespaceSchemaLocation="www.m-files.com/.../appdef-server-v5.xsd"

    Both the applications are explicitly installed, the server and client ones and they are well classified as child under the parent. 

    My Server method is as below

    [VaultExtensionMethod("VaultExtensionMethod_VAF", RequiredVaultAccess = MFVaultAccess.MFVaultAccessNone)]
    private string VaultExtensionMethod(EventHandlerEnvironment env)
    {
    SysUtils.ReportInfoToEventLog("Reached to server");
    return DateTime.Now.ToLongTimeString()
    + " (the input received from client was: " + env.Input
    + ")";
    }

    My client call is as under

    else if (commandId === serverCall) {
    console.log("will call the server method now");
    shellFrame.ShellUI.Vault.Async.ExtensionMethodOperations.ExecuteVaultExtensionMethod(
    "VaultExtensionMethod_VAF", // The name of the extension method to execute.
    "world", // The input (string) to pass it.
    function (response) {
    // The output (string) will be in response; show it.
    MFiles["ShowToast"](response);
    });
    }

     It writes correctly the console log but fails when making call and throws

    shellFrame.ShellUI.Vault.Async.ExtensionMethodOperations.ExecuteVaultExtensionMethod is not a function

    Difference is only that I am not running/overriding the 

    protected override void InitializeApplication(Vault vault)

    why i am skipping that is that my application is already installed correctly classified (parent-client) as i explained earlier. 

    Would appreciate the earlier response. 

  • The schema won't matter; keep it as the later one.  Are you using UIXv2 or UIXv1?  This is an older sample for UIXv1 so the specific code shown won't work in UIXv2, but the concept of declaring and calling the vault extension method is identical.  If you do a search on this site you'll be able to find a UIXv2 version.

  • Thank you  , This is my config in UI application

    <application xmlns:xsi="">www.w3.org/.../XMLSchema-instance" xsi:noNamespaceSchemaLocation="">www.m-files.com/.../appdef-client-v5.xsd">

    Unfortunately, i could not find a link with example for as you mentioned UIXv2. Could you please help me sharing it. 

  • The method you need is this: RunExtensionMethod | M-Files User Interface Extensibility Framework

    This is a helper method that I have in a project that shows how it's called:

    	async _callVaultExtensionMethod(name: string, input: string):Promise<string|undefined>
    	{
    
    		// Run the request.
    		const request: RunExtensionMethodRequest = {};
    		request.method_name = name;
    		request.input = input;
    		const response = (await this.Dashboard.ShellFrame?.ShellUI.Vault.VaultExtensionMethodsOperations.RunExtensionMethod(request))?.output;
    
    		return response;
    	}