spMFsettingsForVaultUpdate

Signature

EXEC dbo.spMFsettingsForVaultUpdate
    @Username = N'Admin',
    @Password = N'********',
    @NetworkAddress = N'example.server',
    @Vaultname = N'MyVault',
    @MFProtocolType_ID = 1,
    @Endpoint = 2266,
    @MFAuthenticationType_ID = 4,
    @Domain = NULL,
    @VaultGUID = NULL,
    @ServerURL = NULL,
    @Debug = 0;

Returns

INT: 1 on success; -1 on error.

Parameters

@Username
  • Type: NVARCHAR(100)

  • Required: No

  • Description: M-Files user with vault admin rights.

@Password
  • Type: NVARCHAR(100)

  • Required: No

  • Description: Password (will be encrypted).

@NetworkAddress
  • Type: NVARCHAR(100)

  • Required: No

  • Description: Host name or IP address of the M-Files server, as reachable from SQL Server. Give the bare host only, without https:// or a path (for example <vault>.cloudvault.m-files.com for a New Cloud vault). This is the address the connector signs in to. Stored in MFVaultSettings.NetworkAddress.

@Vaultname
  • Type: NVARCHAR(100)

  • Required: No

  • Description: Vault name. The connector finds the vault by its GUID first and by this name when the GUID does not match a vault on the server, so it must be correct.

@MFProtocolType_ID
@Endpoint
  • Type: INT

  • Required: No (default = NULL, stored value kept)

  • Description: Port for the connection. When the procedure creates the first MFVaultSettings row it writes 2266 with TCP/IP. For cloud vaults see Cloud vaults.

@MFAuthenticationType_ID
@Domain
  • Type: NVARCHAR(128)

  • Required: No

  • Description: Domain for Windows authentication.

@VaultGUID
  • Type: NVARCHAR(128)

  • Required: No

  • Description: GUID of the vault. Stored in MFSettings (name VaultGUID), not in MFVaultSettings. The installer writes it on a first install from the value entered there, which can be a placeholder. When connecting, the connector looks the vault up by this GUID; if no vault on the server has that GUID it uses @Vaultname instead, and the next run of spMFGetMetadataStructureVersionID (called by spMFVaultConnectionTest and spMFDropAndUpdateMetadata) replaces the stored value with the vault’s real GUID. A placeholder therefore does not stop the connection. fnMFObjectHyperlink, fnMFExcelObjectHyperlink and spMFCreatePublicSharedLink read it to build links to objects.

@ServerURL
  • Type: NVARCHAR(128)

  • Required: No

  • Description: Web address of M-Files, with http:// or https:// and the fully qualified host name, and no trailing slash. Stored in MFSettings (name ServerURL). It is not used for the vault connection; fnMFObjectHyperlink, fnMFExcelObjectHyperlink and spMFCreatePublicSharedLink use it to build web links. Leave it unset unless those links are used.

@Debug
  • Type: SMALLINT

  • Required: No (default = 0)

  • Description: Debug level.

Purpose

Procedure to allow updating of specific settings in both MFVaultSettings and MFSettings related to the vault Table MFVaultSettings show the settings to connect to M-Files. MFSettings table show the other settings for the Connector.

Pass only the settings that change. A parameter left NULL keeps its stored value, so a value cannot be cleared by passing NULL.

Protocol and authentication type IDs

@MFProtocolType_ID takes the ID of a row in MFProtocolType:

ID

Protocol

Value passed on

1

TCP/IP

ncacn_ip_tcp

2

SPX

3

Local Procedure Call

ncalrpc

4

HTTPS

ncacn_http

5

gRPC

grpc

@MFAuthenticationType_ID takes the ID of a row in MFAuthenticationType:

ID

Authentication type

Settings the connector uses

1

Unknown

Not for use

2

Current Windows User

Vault name only; user name, password, domain, network address, protocol and endpoint are not used

3

Specific Windows User

User name, password, domain, network address and vault name; protocol and endpoint are not used

4

M-Files User

User name, password, network address, protocol, endpoint and vault name; domain is not used

Check the rows in a database with:

SELECT * FROM dbo.MFProtocolType;
SELECT * FROM dbo.MFAuthenticationType;

Cloud vaults

The defaults the procedure and the examples below start from (TCP/IP, endpoint 2266) are on-premises values. A cloud vault needs its own protocol and endpoint:

  • New Cloud: protocol 5 (gRPC), endpoint 443, @NetworkAddress the vault host such as <vault>.cloudvault.m-files.com.

  • Classic Cloud: protocol 4 (HTTPS), endpoint 443. Confirm the port in the vault’s connection details from M-Files Cloud.

In both cases @NetworkAddress is the bare host name. @ServerURL is not needed for the connection.

Examples

-- check out the settings tables
SELECT * FROM mfVaultSettings
SELECT * FROM  [MFSettings] AS [ms]

--the Protocol type and authentication type are referenced in related tables
SELECT * FROM [dbo].[MFVaultSettings] AS [mvs]
LEFT JOIN [dbo].[MFProtocolType] AS [mpt]
ON mvs.[MFProtocolType_ID] = mpt.[ID]
LEFT JOIN [dbo].[MFAuthenticationType] AS [mat]
ON mvs.[MFAuthenticationType_ID] = mat.[ID]

--updating the M-Files user name
EXEC [spMFSettingsForVaultUpdate] @Username = 'Admin'

--change the password

EXEC spmfsettingsForVaultUpdate @Password = 'MotSys123'

-- It is only necessary to specify the settings that need to change

EXEC dbo.spMFSettingsForVaultUpdate
    @Username = N'MFSQLConnect',
    @Password = N'<vault password>',
    @MFProtocolType_ID = 5;

-- New Cloud vault (gRPC, port 443, M-Files user)

EXEC dbo.spMFSettingsForVaultUpdate
    @Username = N'MFSQLConnect',
    @Password = N'<vault password>',
    @NetworkAddress = N'<vault>.cloudvault.m-files.com',
    @Vaultname = N'<vault name>',
    @MFProtocolType_ID = 5,
    @Endpoint = 443,
    @MFAuthenticationType_ID = 4;

-- Classic Cloud vault (HTTPS, port 443, M-Files user);
-- confirm the host and port in the vault's connection details from M-Files Cloud

EXEC dbo.spMFSettingsForVaultUpdate
    @Username = N'MFSQLConnect',
    @Password = N'<vault password>',
    @NetworkAddress = N'<server host name>',
    @Vaultname = N'<vault name>',
    @MFProtocolType_ID = 4,
    @Endpoint = 443,
    @MFAuthenticationType_ID = 4;

-- then test the connection
EXEC dbo.spMFVaultConnectionTest;

Changelog

Date

Author

Description

2026-11-16

AC

Document the ID values, cloud settings, address parameters and vault GUID

2016-10-12

LC

Update procedure to allow for updating of settings into the new MFVaultSettings Table

2016-08-22

LC

Change settings index

2016-04-20

LC

Created Procedure