M-Files
M-Files connects your flow to a vault of the M-Files document management system. With it you can search objects, upload new documents, download a document’s file, lock a document to edit it and unlock it with a new version, or delete it.
Use it when your company’s documents are stored in M-Files and you want a flow to archive or retrieve them without anyone doing it by hand.
When to use it
- Signed contracts arrive by email and you want to upload them to M-Files with their title.
- An AI agent needs to find a document by its name and read its content to answer.
- You want to download a report from M-Files to send it by email or summarise it.
- A flow produces a new version of a document and you want to store it in M-Files with a change comment.
- You want to delete documents that are no longer needed.
Configuration
You need an M-Files credential with your server address, your username, your password and the vault’s identifier (GUID). See Credentials.
| Field | What it does |
|---|---|
| Credential (required) | The M-Files credential used to access the vault. |
| Operation (required) | What the component does. See Operations. |
| Search By | Only in Search Objects. By Name searches by text; By ID returns one specific object by its number. Default: By Name. |
| Search Query | Only in Search Objects with By Name. The text to look for in the objects’ data. Required in that case. |
| Limit | Only in Search Objects with By Name. Maximum number of results. Default: 10. |
| Mode | In the operations that work on an existing object. Custom: you type the object’s number in Object ID. Dynamic: you pick the object from the Object list, loaded from the vault. Default: Custom. |
| Object Type | The M-Files object type, for example Document (0). The list is loaded from your vault. It appears in the operations that work on an object and in Search Objects with By ID. |
| Object ID | The object’s number in M-Files. Required with Mode set to Custom and in Search Objects with By ID. |
| Object | With Mode set to Dynamic. The list of objects of the chosen type, to select one without knowing its number. |
| File ID | Only in Download Document. The file to download, if the object has several. Empty, the first one is downloaded. |
| File URL | Required in Upload Document and Check In. The address of the file to upload, or the file encoded in Base64 as a data: value. |
| Document Title | Only in Upload Document. The title of the new document in M-Files. Empty, the file name is used. |
| Check-in Comment | Only in Check In. An optional comment describing the changes in the new version. |
Operations
| Operation | What it does |
|---|---|
Search Objects | Searches objects by text or returns one by its number, with its properties. |
Upload Document | Uploads a file and creates a new document with it in the vault. |
Download Document | Downloads a document’s file. |
Check Out | Locks an object for editing, so nobody else can change it in the meantime. |
Check In | Replaces the file of a locked object with a new one, saves the comment and unlocks it. |
Cancel Check Out | Removes the lock from an object without saving changes. |
Delete Object | Deletes an object. If it was locked, the lock is removed first. The object moves to the vault’s deleted view. |
Output
The Data output returns M-Files’ answer. Search Objects returns one item per object found, with its properties. Download Document returns the file encoded in Base64, together with its name and type, ready to pass to a component that reads or attaches it. The other operations return M-Files’ confirmation.
The component can also be connected to an Agent as a tool, so the agent searches or downloads documents when it needs them. See Tool Mode.
Example
A law firm wants to archive in M-Files the contracts that clients send back signed.
- The flow starts with the email that carries the contract as an attachment.
- Add M-Files with the
Upload Documentoperation. - In File URL connect the attachment’s address and in Document Title write
Contractfollowed by the client’s name. - Connect Data to a messaging component that tells the person in charge that the contract is archived.
Good practices
- To change a document’s content, run
Check Outfirst and thenCheck Inwith the new file. - Use Mode set to
Dynamicwhile you test the flow, to pick the object from the list. When the object’s number comes from an earlier step, useCustom. - If the Object Type list does not load, check that the credential is correct and reload it with the refresh button.