Vault management (IRPCVaultsAdmin)
Creates, attaches, detaches, destroys, upgrades, backs up, restores and copies the vaults of a server, and takes them offline and online.
Use this interface to add, modify and remove vaults. Use IRPCVaultsAdminBasic to get document vault definitions.
| gRPC service | MFiles.IRPCVaultsAdmin |
|---|---|
| Book and level | Administration API, specialized |
| Methods | 23 |
| Proto file | mfiles/IRPCVaultsAdmin.proto |
Overview
Server-level vault management: the vault commands of M-Files Admin and of the M-Files API's server vault management operations. Use it from administration tools and automation scripts that manage the vaults of an on-premises server. Read the definitions of existing vaults with GetVaultsAdmin and GetVaultAdmin; administer the contents of one vault with IRPCVaultAdmin.
Session and rights. Every method names its vault in the request, so a server-level session is
enough: log in with login_data.vault_guid = {00000000-0000-0000-0000-000000000000}. The
methods need a server right, and only logins with the system administrator server role
(SRVROLES.system_administrator) have server rights:
Server right (ServerAccess) |
Methods |
|---|---|
manage_vaults |
All methods not listed below |
backup_vaults |
BackUpVault |
restore_vault |
RestoreVault, GetBackupFileContents |
Exceptions: UpdateVault and GetFullTextSearchInfo also accept a vault session with full
control of the vault, and OptimizeVaultMetaDataDatabase a vault session with the vault right
manage_scheduled_jobs. A missing server right fails with gRPC status UNKNOWN and the message
"Access denied. You do not have the server-level access rights required by this operation."
(error codes 0x800400A8 and 0x800407E4).
Tasks and the usual order of calls:
- Create a vault: GetDefaultDataFolderPrefix, TestConnectionToSQLDatabase (SQL Server vaults), then CreateNewVault.
- Change a vault: UpdateVault, UpgradeVault.
- Take a vault out of use: CheckForOpenSessions, TakeVaultOffline, BringVaultOnline.
- Move a vault between servers: DetachVault keeps the data; AttachExistingVault attaches it again (check first with AttachVaultToOneDbTest when the server has joined a subscription).
- Delete a vault and its data: DestroyVault.
- Back up, restore and copy: BackUpVault, GetBackupFileContents, RestoreVault, CopyVault.
- Maintenance: OptimizeVaultMetaDataDatabase, EncryptFileData, GetFullTextSearchInfo.
- Replica vaults and ground link proxies (special deployments): CreateNewReplicaVault, UpdateReplicaVault, CreateNewGroundLinkProxy, UpdateGroundLinkProxy.
Background jobs. BackUpVault, CopyVault, EncryptFileData,
OptimizeVaultMetaDataDatabase, RestoreVault (unless synchronous) and, when they start a
migration, UpdateVault and UpdateGroundLinkProxy create a temporary scheduled job and return
its ID in task_id before the work is done. Follow the job like the M-Files API does:
- Call GetScheduledJobRunInfo
with
scheduled_job=task_idabout twice a second. - The job has finished when
is_runningis false andcurrent_stepis not -1 (-1 means the job has not started yet). - Check
last_run_succeededandlast_run_errors;outputholds the job's result. - Remove the finished job with RemoveScheduledJob. Cancel a running job with CancelScheduledJob.
These jobs are server-level jobs (except an optimization started with a vault session, which is a
job of that vault). Server-level and vault-level jobs have separate IDs: read a server-level job
with a server-level session, which needs the server right manage_jobs.
Methods
| Method | Summary | Facts |
|---|---|---|
| AttachExistingVault | Attaches an existing vault (metadata database and file data files) to the server. | admin session |
| AttachVaultToOneDbTest | Checks whether existing vault files can be attached on a server that has joined a subscription, without attaching them. | admin session idempotent |
| BackUpVault | Backs up a vault into a backup file on the server. | admin session |
| BringVaultOnline | Brings an offline vault online so that users can log in to it again. | admin session idempotent |
| CheckForOpenSessions | Checks whether users have open sessions to a vault: succeeds if there are none and fails with a list of the sessions otherwise. | admin session idempotent |
| CopyVault | Copies the specified vault into a new vault (creates the target vault). | admin session |
| CreateNewGroundLinkProxy | Creates a ground link proxy, a vault of type VAULT_TYPE_GROUND_LINK_PROXY. | admin session |
| CreateNewReplicaVault | Creates a new replica vault. | admin session |
| CreateNewVault | Creates a new document vault. | admin session |
| DestroyVault | Destroys a vault: deletes its metadata database and its file data permanently and removes it from the server. | admin session |
| DetachVault | Removes the vault from the server's list of registered vaults but does not remove the metadata database or file data files. | admin session |
| EncryptFileData | Encrypts the existing files of a vault with the vault's latest encryption key. | admin session |
| GetBackupFileContents | Reads the vault identity and data folders stored in a backup file on the server. | admin session idempotent |
| GetDefaultDataFolderPrefix | Gets the default data folder prefix of new document vaults. | admin session idempotent |
| GetFullTextSearchInfo | Gets the languages that the full-text search of a vault supports, or the server's defaults. | admin session idempotent |
| OptimizeVaultMetaDataDatabase | Optimizes the metadata database of a vault. | admin session |
| RestoreVault | Restores a vault from backup files on the server and attaches it. | admin session |
| TakeVaultOffline | Takes a vault offline: users cannot log in to it until it is brought online again. | admin session idempotent |
| TestConnectionToSQLDatabase | Tests whether the server can connect to a Microsoft SQL Server database, for example before creating a vault in it. | admin session idempotent |
| UpdateGroundLinkProxy | Updates the definition of a ground link proxy. | admin session idempotent |
| UpdateReplicaVault | Updates the definition of a replica vault. | admin session idempotent |
| UpdateVault | Changes the definition of a vault: name and other registration data, data folders, database, file data storage and vault variables. | admin session idempotent |
| UpgradeVault | Upgrades an old document vault to the current version. | admin session idempotent |