M-Files UI Extensibility Framework
Delegating Work to M-Files Server
M-Files UI Extensibility Framework > Technical Articles > Delegating Work to M-Files Server

M-Files Server runs customizable logics attached to event handlers. Majority of the event handler invocations are bound to vault object operations or other user actions. However there is one event handler type, VaultExtensionMethod, that is bound to dedicated M-Files API invocation only. This event handler is intended for implementing delegated logics from M-Files client and from other invocation sources.

Use cases:

The VaultExtensionMethod event handler can be invoked with M-Files API method Vault.ExtensionMethodOperations.ExecuteVaultExtensionMethod. The method signature:

Vault.ExtensionMethodOperations.ExecuteVaultExtensionMethod Signature
Copy Code
HRESULT ExecuteVaultExtensionMethod(
  [ in ] BSTR MethodIdentifier,
  [ in ] BSTR Input,
  [ out, retval ] BSTR* Output
 );
https://developer.m-files.com/APIs/COM-API/Reference/

The MethodIdentifier parameter needs to match with the event handler name on the server. The Input parameter is passed for the event handler, and can be accessed as Input.Value in VBScript. The VBScript produces the result string and places it to Output variable, and at the caller end the result will be the return value of the ExecuteVaultExtensionMethod call.

Both input and output are string values. If more parameters or complex types must be passed for the server and back, they must be serialized to string format. Any serialization format can be used, but JSON format is popular here because of its easy readability for both human and machine readers and good support in various languages. See http://json.org.

 

 

See Also