The M-Files COM/.NET API
The M-Files COM/.NET API can be used from any software that can interact with COM. This is our most comprehensive API and provides interfaces for most “user” and “administrative” functions. The API is available on both 32-bit and 64-bit versions and is typically referenced from your code by adding a reference to the nuget package within your project:
Note that the COM API nuget package is the recommended mechanism to add a reference a project, but deploying the nuget package itself is not sufficient to run applications that use it. You must still ensure that the machine running the application has an element of M-Files(M-Files Desktop, M-Files Server, or M-Files Server Tools) installed for the application to work.
The API can be used to create almost any solution that retrieve or process information within an M-Files vault, such as:
- Retrieving content from M-Files and display it within another application (e.g. to retrieve customer documents to display within a CRM),
- Creating objects within M-Files (e.g. to create an Order object when a user completes payment online),
- Moving objects through a workflow as required (e.g. when an electronically-signed version of a document is received, move the contract to another state).
The COM API requires the same version of the API on the client machine as the server (e.g. if communicating with an M-Files 2015.3 server, the API must also be of the same version).
API modes (client vs. server)
The primary focus of creating a connection to the server is to retrieve a Vault object. The Vault object can then be used to query content from the vault, or to process it in some manner.
The API can be used in either “server” or “client” mode. Some API methods are only available in one of the modes.
-
A connection in client mode is designed to be used in situations where both the user is present, and a connection to the vault has been created in the M-Files Desktop Settings. In client mode, built-in M-Files dialogs (e.g. the “create new object” metadata card) can be shown to the user for them to interact with.
-
A connection in server mode is designed to be used in situations where the user is not necessarily present, and/or a connection to the vault has not been created in the M-Files Desktop Settings. In server mode, dialogs cannot be shown and the code must programmatically undertake these actions. The server mode allows connections to M-Files servers using the standard protocols – TCP/IP, HTTPS, and LPC – and supports all the same authentication schemes that M-Files supports.
Common API objects
User operations
For finding the vault structure:
- VaultObjectTypeOperations - used to retrieve information about the object types configured in the vault.
- VaultClassOperations - used to retrieve information about the classes configured in the vault.
- VaultClassGroupOperations - used to retrieve information about the document class groups configured in the vault.
- VaultPropertyDefOperations - used to retrieve information about the property definitions configured in the vault.
- VaultValueListOperations - used to retrieve information about the value lists configured within the vault.
- VaultValueListItemOperations - used to retrieve information about items within value lists configured within the vault.
- VaultWorkflowOperations - used to retrieve information about workflows and workflow states within the vault.
For finding objects:
- VaultObjectSearchOperations - used to search the vault for matching objects.
- VaultViewOperations - used to enumerate the contents of views to find objects.
More information on searching for objects can be found in the dedicated pages.
For working with objects (finding properties, checking in and out, manipulating files, etc.)
- VaultObjectOperations - used to load, check out, check in, or process objects within the vault.
- VaultObjectPropertyOperations - used to load or alter property values (i.e. metadata items) of objects within the vault.
- VaultObjectFileOperations - used to retrieve or alter files on objects within the vault.
Administrative operations
For working with the vault structure:
- VaultObjectTypeOperations - used to manage the object types configured in the vault.
- VaultClassOperations - used to manage the classes configured in the vault.
- VaultClassGroupOperations - used to manage the document class groups configured in the vault.
- VaultPropertyDefOperations - used to manage the property definitions configured in the vault.
- VaultValueListOperations - used to manage the value lists configured within the vault.
- VaultValueListItemOperations - used to manage items within value lists configured within the vault.
- VaultWorkflowOperations - used to manage workflows and workflow states within the vault.
- VaultUserOperations - used to retrieve and manage users within the vault.
- VaultUserGroupOperations - used to retrieve and manage user groups within the vault.
- VaultNotificationOperations - used to send custom notifications.
- VaultLoginAccountOperations - used to retrieve and manage login accounts within the server.