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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MFiles.Grpc" Version="26.11.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MFiles.Grpc" Version="26.11.0" />
                    
Directory.Packages.props
<PackageReference Include="MFiles.Grpc" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MFiles.Grpc --version 26.11.0
                    
#r "nuget: MFiles.Grpc, 26.11.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MFiles.Grpc@26.11.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MFiles.Grpc&version=26.11.0
                    
Install as a Cake Addin
#tool nuget:?package=MFiles.Grpc&version=26.11.0
                    
Install as a Cake Tool

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:

  1. the MFILES_PROTO_DIR environment variable: the folder that contains mfiles/structs.proto;
  2. proto/ in this folder;
  3. ../../proto, where the API bundle keeps them next to samples/;
  4. src/Build/IDL/Docs/out/grpc-api-docs/proto when 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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