The Vault Reference (VBScript)
If you need to develop new scripts or edit existing, we recommend that you replace VBScript with Vault Application Framework (VAF) development for future compatibility. For more information see the Vault Application Framework section.
When connecting using the COM API, you must use a client connection or server connection to connect to the server and retrieve a vault reference. When using VBScript a reference to the current vault is automatically provided via the Vault
VBScript variable.
Using the vault reference
The Vault
reference is the primary method of interacting with contents of an M-Files vault. It is an instance of the Vault COM API class. The Vault
reference is a transactional reference, meaning any modifications to the vault contents done during the VBScript running will be rolled back in the case of exceptions being raised by the code.
The Vault
reference is typically used to search for objects, create new objects, or alter existing objects.
Auditing
Special consideration should be given to operations that could affect the current object’s audit trail (e.g. setting the current object’s properties).
Security
It is important to note that the Vault
reference provided within VBScript is connected to the M-Files server as an internal administrative user. Any operations executed against the vault using this reference will not respect the current user’s permissions.
The current user’s ID is available via the CurrentUserID
VBScript variable. The current user’s session information is available via Vault.SessionInfo
. Search results can be filtered by user permissions if needed.
Vault Application Framework
The Vault Application Framework has its own page on the Vault reference providing additional relevant information to interacting with the vault via the Vault Application Framework.