Guides
Quickstarts in Python, C# and Go, and task recipes with tested code in all three languages.
- Python quickstart -- From an empty folder to a Python program that logs in to an M-Files vault over gRPC and lists its 10 most recently modified documents, on M-Files Cloud or on-premises.
- C# quickstart -- From nothing to a .NET console app that logs in to an M-Files vault over gRPC and lists the 10 most recently modified documents, on M-Files Cloud or on-premises.
- Go quickstart -- From nothing to a Go program that logs in to an M-Files vault over gRPC and lists the 10 most recently modified documents, on M-Files Cloud or on-premises.
- Connect, log in and keep the session -- Check the server version and capabilities anonymously, log in to a vault, read the session information, keep the session alive and log out.
- Read the vault structure -- List object types, classes and property definitions, find the properties of a class, and resolve the ID of a class or property by its alias.
- Search for documents -- Find the documents of a class modified in the last N days, newest first, with SearchObjects - object type, deletion, class and date conditions, sorting and a limit.
- Read an object and its properties -- Get the latest version of an object with all its property values in one call, and print text, number, date, timestamp, lookup and multi-select lookup values.
- Download a file -- Download a file of a document version to disk with a download session - DownloadFile_Begin, DownloadFile_ReadBlock in a loop, DownloadFile_Stop.
- Create a document -- Upload a file with UploadTempFile and UploadTempFileCommit, then create a single-file document with a class, a title and an access control list with AddObjectWithFiles.
- Update properties safely -- Change property values without overwriting other users' changes - SetProperties on the version you read with fail_if_newer_version_exists, or CheckOut, SetProperties and CheckIn.
- Change the workflow state -- Read a workflow's states and the transitions the user may take from an object's current state, and move the object to another state by setting its State property.
- Page through large result sets -- Visit every object that matches a search, page by page, by sorting on object ID and asking each page for the objects after the last ID of the previous one.
- Handle errors -- Catch a failed call, decode the M-Files error code from the error trailers, and tell "not found" and "access denied" apart from other errors.