MFiles.Grpc
26.11.0
Prefix Reserved
dotnet add package MFiles.Grpc --version 26.11.0
NuGet\Install-Package MFiles.Grpc -Version 26.11.0
<PackageReference Include="MFiles.Grpc" Version="26.11.0" />
<PackageVersion Include="MFiles.Grpc" Version="26.11.0" />
<PackageReference Include="MFiles.Grpc" />
paket add MFiles.Grpc --version 26.11.0
#r "nuget: MFiles.Grpc, 26.11.0"
#:package MFiles.Grpc@26.11.0
#addin nuget:?package=MFiles.Grpc&version=26.11.0
#tool nuget:?package=MFiles.Grpc&version=26.11.0
M-Files gRPC API client for .NET
The NuGet package MFiles.Grpc for the M-Files gRPC API, with runnable examples: a quickstart
and one program per task recipe. The guides on
developer.m-files.com embed their code.
| Project | What it is |
|---|---|
src/MFiles.Grpc |
The package: the client code generated from the protos, and the helpers |
examples/Quickstart |
Console app: log in and list the 10 most recently modified documents |
examples/Recipes |
Console app: one recipe per run, chosen by the first argument |
tests/MFiles.Grpc.Tests |
Unit tests of the helpers; they need no server |
The generated classes and the helpers are in the namespace MFiles.Grpc: messages such as
SearchObjectsRequest, one client per service, such as IRPCSearch.IRPCSearchClient, and
MFilesConnection. The connection does what the protos cannot say: it opens the channel (TLS or
not, an optional custom root certificate, the message size limits of M-Files' own client), adds
the M-Files call metadata to every call, logs in and out (with a password, a token or through the
browser), decodes errors into MFilesException and reads the vault's metadata structure version.
The package is a preview: its helpers can still change between releases.
Install
From NuGet, the version for your server (see Versions):
dotnet add package MFiles.Grpc
Or build from this folder with the .NET SDK 10 or later. Grpc.Tools generates the client
classes from the protos when MFiles.Grpc builds; it finds them in this order:
- the
MFILES_PROTO_DIRenvironment variable: the folder that containsmfiles/structs.proto; proto/in this folder;../../proto, where the API bundle keeps them next tosamples/;src/Build/IDL/Docs/out/grpc-api-docs/protowhen the samples run inside the M-Files repository.
Packages (pinned in src/MFiles.Grpc/MFiles.Grpc.csproj): Grpc.Net.Client 2.85.0,
Google.Protobuf 3.36.2 and Grpc.Tools 2.85.0 (build time only).
Configure
MFilesSettings.FromEnvironment() and the examples read environment variables:
| Variable | Meaning |
|---|---|
MFILES_ADDRESS |
The server's gRPC endpoint, host:port. M-Files Cloud: <vault host>:443 |
MFILES_TLS |
true (default) or false for a server without TLS |
MFILES_CA_CERT |
Optional: a PEM file of the root certificate to trust instead of the system's |
MFILES_VAULT |
The vault GUID with braces |
MFILES_USERNAME, MFILES_PASSWORD |
An M-Files user account |
MFILES_AUTH |
browser to sign in through the browser with the vault's OAuth plugin, such as M-Files Login Service; then MFILES_VAULT is optional |
MFILES_REMEMBER_SIGN_IN |
true to keep the refresh token of a browser sign-in in Windows Credential Manager |
MFILES_TOKEN, MFILES_AUTH_PLUGIN, MFILES_AUTH_SCOPE |
Or an SSO token, and optionally the authentication plugin and configuration scope that accept it |
$env:MFILES_ADDRESS = 'localhost:7766'
$env:MFILES_TLS = 'false'
$env:MFILES_VAULT = '{7BBEA0BC-40D8-4BCB-A67D-8A3ACFBDB575}'
$env:MFILES_USERNAME = 'alice'
$env:MFILES_PASSWORD = Read-Host -Prompt 'Password'
Examples
dotnet run --project examples\Quickstart
dotnet run --project examples\Recipes -- search 1 30 10
| Recipe | Arguments (all optional) |
|---|---|
connect |
|
vault-structure |
class alias, property alias |
search |
class ID (1), days (30), limit (10) |
read-object |
object ID (437), object type (0) |
download-file |
document ID (437), folder (%TEMP%\mfiles-grpc-samples) |
create-document |
--keep |
update-properties |
--keep |
workflow-state |
workflow ID (107), initial state (137), target state (141), --keep |
paging |
page size (100) |
errors |
|
login-service |
--remember; signs in through the browser, so a person must be present |
The defaults suit the M-Files Sample Vault. Recipes that write create documents whose titles
start with [docs-test] and delete them at the end unless you pass --keep.
Tests
dotnet test tests\MFiles.Grpc.Tests # unit tests; no server needed
.\run-tests.ps1 # the unit tests, then every example against a vault
.\run-tests.ps1 -Recipe search, paging
run-tests.ps1 builds the solution, runs the unit tests, the quickstart and every recipe except
login-service, and fails if any of them fails. It reads the connection from
%USERPROFILE%\.mfiles-grpc-docs\test-config.json (section local by default), so no
credentials are kept in the repository.
Versions
There is one package version per M-Files Server release: 26.11.0 is for 26.11, 26.11.1 a
revision of it. A version works with its server release and later ones; with an older server,
methods that the server does not have fail with Unimplemented.
License
MIT; see LICENSE.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Google.Protobuf (>= 3.36.2)
- Grpc.Net.Client (>= 2.85.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 26.11.0 | 43 | 11/6/2026 |