Vault Object

The Vault object represents the current vault and is available to all event procedures.

ClosedVault Object Properties

The Vault object provides the following properties, most of which are read-only. To affect some read-only properties requires user interaction or custom event procedures.

ClosedArgument Property

A variable stored with the Vault object for as long as the current user has the vault open. The variable is local to the user and cannot be seen by other users.

Syntax

Argument(Name) As Variant

Remarks

The value of Name is case-sensitive.

Following are the predefined, read-only Vault object arguments that you can use to obtain additional information that may be useful when working with particular events.

Vault object arguments
Argument Description

Vault.Argument("__$$RelatedTransmittal")

A reference to a transmittal document that is related to a submittal. Useful in the DocGenericEvent_BeforeNewDocument event.

Vault.Argument("__$$SubmittalSender")

A reference to the sender of a submittal. Useful in the DocGenericEvent_BeforeNewDocument event.

For more information about arguments, see Object Arguments.

ClosedCurrentWorkArea Property

An object that represents the current work area context. Read-only. The work area feature has been deprecated.

Syntax

CurrentWorkArea As IASWorkArea

ClosedHasFeature Property

True if the specified feature is enabled for the current vault. The Feature argument is specified as a long integer that represents one or more of the AS_FEATURES constants. Read-only.

Syntax

HasFeature(Feature) As Boolean

ClosedMoment Property

When the vault is opened to a specific moment in the past, this property returns that date and time. Read-only.

For more information about vault history, see Vault History.

Syntax

Moment As Date/Time

ClosedName Property

Returns the name of the current object. Depending on the object type, this property returns the display name of the object or it returns the internal name and may be read-only.

Syntax

Name As String

Remarks

If the current object is a Package, it must be in the Open status to set the value.

If the current object is a User, this property is the short name of the user as stored in the user's Meridian account information and is read-only. This property can be used to specify the recipient's email address and either an empty string or no value set in the Address property. If an email address is specified in Name, it must be surrounded with carets (<>). When used with Microsoft Outlook, the Name property may contain the user's full name or last name and Outlook will attempt to resolve the name to the email address in the default address book.

Meridian user names can be shown in different formats determined by the UserNameFormatserver registry setting.

ClosedOption Property

Gets a customization setting that is stored on the Settings page in the Vault Settings group in the Environment branch in Meridian Enterprise Configurator. Read only.

The option name is specified as <SectionName>.<OptionName> and must match the structure and names used on the Settings page. The supported structure is the same as used on the tabs of the Application Link Settings group in the Environment branch in Meridian Enterprise Configurator.

Syntax

Option As String

ClosedPath Property

The path of the vault expressed as \\<Machine>\<DataStore>\<Section>.

Syntax

Path As String

ClosedQuery Property

An object that represents the specified query. Read-only.

Syntax

Query(Name) As IASQuery

ClosedRootFolder Property

An object that represents the root folder of the vault. Read-only.

For more information on folder objects, see Folder Object. To learn about the folder structure of a vault, see Field-Path Definition.

Syntax

RootFolder As IASFolder

ClosedRootURL Property

The PowerWeb URL of the root folder of the vault. Read-only.

Syntax

RootUrl As String

ClosedScope Property

An object that represents the scope with a given name.

Syntax

Scope(ScopeName As String) As IASScope

ClosedSequence Property

An object that represents the specified vault sequence.

Important!

Using the vault name as a sequence name can cause errors and possibly crash the Meridian EDM Server service. 

For information about the Sequence object, see Sequence Object. For information about using sequences in file names, see File Name Calculation.

Syntax

Sequence(Name) As IASSequence

ClosedServerName Property

The name of the server hosting the current vault. Read-only.

Syntax

ServerName As String

ClosedServerProductCode Property

A number expressed as a string that represents the server product. Read-only.

Syntax

ServerProductCode As String

ClosedServerTimeGMT Property

The system time of the server computer expressed in Greenwich Mean Time (GMT). Read-only.

Syntax

ServerTimeGMT As Date

ClosedStaticCollection Property

This property can be used to get access to a static collection, or create a static collection.

Syntax

StaticCollection(CollectionName, [Create]) As IASStaticCollection
Parameters
Name Description
CollectionName The name of the static collection.
Create This parameter allows you to create a new static collection.

Remarks

If you assign the result of this property to a variable, then you must set the variable to Nothing in the same subroutine or function.

ClosedTable Property

An object that represents the specified table. Read-only. 

For information about tables, see Create And Edit Tables.

Syntax

Table(Name) As IASTable

ClosedTask Property

An object that represents the current Task object. Read-only.

For more information about task objects, see Task Object.

Syntax

Task As IASTask

ClosedUser(Name) Property

An object that represents the specified user. Read-only.

For more information about user objects, see User object .

Syntax

User(Name) As IASUser

ClosedWebAccessLocationID Property

The PowerWeb URL of the vault. Read-only.

Syntax

WebAccessLocationID As String

ClosedWorkIsolationMode Property

True if the Work Isolation Mode of the current vault is enabled. Read-only.

Work Isolation Mode is a legacy feature. We still support customers who have it enabled, but we do not allow it to be enabled in new Vaults.

Syntax

WorkIsolationMode As Boolean

ClosedVault Object Methods

The Vault object provides the methods described below.

ClosedAuditEvent Method

Adds custom command events to the audit log database.

Syntax

Sub AuditEvent(EventName As String, [ObjectName As String], [ActionArg1 As String], [ActionArg2 As String], [ActionArg3 As String])
Parameters
Name Description

EventName

The name of the event that you want to add to the audit log database.

ObjectName

Optional name of the vault object upon which the custom event occurs.

ActionArg1

Optional argument that describes the action taken.

ActionArg2

Optional argument that describes the action taken.

ActionArg3

Optional argument that describes the action taken.

Remarks

Requires a Meridian FDA Module server license.

The object specified by ObjectName must not be Nothing. The optional action arguments can be anything that you decide. Each argument should be one parameter of the action taken and should resemble the general pattern used by the built-in audit entries listed in Audited Actions.

ClosedCallRemote Method

Executes a remote procedure call.

Syntax

CallRemote(URL As String, Username As String, _
	Password As String, RemoteVault As String, _
	Script As String, [Args], [Flags As Long = 2])
Parameters
Name Description

URL

Location of the server with which to connect.

Username

User account to use to connect to the server.

Password

Password of the user account.

RemoteVault

Name of the remote vault with which to connect.

Script

Name of the procedure to execute on the remote server.

Args

Optional arguments for the procedure to execute.

Flags

Optional flags from the AS_CALLREMOTE_FLAGSS enumeration.

Example

The following examples show how to use this method.

Example function defined in the called vault:

Function RemoteTest (First, Second, Third)
  RemoteTest = "RemoteTest returns: " & First & ", " & Second & ", " & Third
End Function

Example procedure defined in the calling vault:

Sub Test_Execute(Batch)
  vArg = Array ("One ", "Two", "Three")
  vRes = Vault.CallRemote ("http://MyServer/Meridian", "MyUserName", _
         "MyPassword", "MyVaultName", "RemoteTest", VArg, AS_CRF_MULTIARGS)
  WinMsgBox vRes
End Sub

ClosedComposeURL Method

Gets a PowerWeb URL for the current vault.

Syntax

ComposeURL(Object As Object, [Flags As AS_URL_FLAGS = AS_URL_FULLPATH])
Parameters
Name Description

Object

An object for which to return the address.

Flags

Optional long integer that represents one or more AS_URL_FLAGS constants.

Return Value

A string URL.

Remarks

The icon shown by shortcuts created with the return value of this method and the command line to execute those shortcuts are configured with the following registry keys:

The URL for the rendition of a document can be calculated by appending ;rend to the URL of the main document as in the following example:

http://<ServerName>/Meridian/<VaultName>/MyDocument.doc;rend

ClosedCreateNewDocument

Creates a new document in the vault. Option to add references between new documents and update properties for the new document object.

Calling the Vault.CreateNewDocument method triggers the Vault_Open event in script.

Syntax

Vault.CreateNewDocument(documentPath As String, fileName As String, docTypeName As String, templateName As String)
Parameters
Name Description
documentPath The location where the document should be created. This path should not include the file name.

fileName

Name of the new document.

docTypeName

Optional parameter which specifies the document type.

templateName

Optional parameter which specifies the name of the template configured for the document type.

Return Value

A new document object.

Example

Sub DocGenericEvent_AfterNewDocument(Batch, Action, SourceFile, DocType, DocTemplate)
    If Document.DocumentType = "DocWithObject" And Action = AS_IT_CREATED Then
        Dim newDoc 
      Set newDoc = Vault.CreateNewDocument("\AT_4_TagOperations\Objects","New.tag","Object","ObjectTemplate")
        Document.GetReferences("DocObjectReference").Add(newDoc.GlobalID)
        newDoc.Property("psObject.ObjectDescription") = "New Created object"
        newDoc.Property("psObject.ObjectType") = "ObjectType-01"
        newDoc.Property("psObject.ObjectNumber") = "ObjectNumber-01"
    End If    
End Sub

ClosedDisplayName Method

Returns the display name of a specified scope.

Syntax

Vault(Scope As String).DisplayName
Parameters
Name Description
Scope

The name of the scope for which to return the display name.

Return Value

The display name of the specified scope.

ClosedExecSQL Method

Executes an SQL query using the specified connection string.

Syntax

ExecSQL(Connection As String, Query As String, [Parameters])
Parameters
Name Description

Connection

A valid connection string for the database with which to execute the query.

This parameter also accepts a variable that represents one of the following vault databases. The variables are case-sensitive.

$$TransManDB — the Transmittal Management Module database (if installed)

$$UserDB — the user account database

Note:

When the Use Enterprise Server for user management option is enabled in the EDM Server properties in the Meridian Enterprise Administrator, the reserved word $$UserDB cannot be used in VBScript with the Vault.ExecSQL method to access the Meridian Enterprise Server user database.

$$<QueryName> — an external table query connection string created as described in Create And Edit External Data Queries

Query

A valid SQL query expression.

Parameters

Optional value or array of values to be used in a parametric query. The values do not need to be strings. The array should contain a value for each instance of the ? character in the SQL query.

ClosedFindDocuments Method

Searches for documents in the Main area of the current vault.

Syntax

FindDocuments([WildCard As String], [DocumentTypeNames As Variant],
[Criteria As Variant], OrSearch As Boolean) _
As IASDocuments
Parameters
Name Description
WildCard Optional string that represents a file system wildcard pattern. If omitted, the scope of file names will include all documents (*.*).
DocumentTypeNames

Optional variant array of document type names to which to restrict the search result. If omitted, the scope of document types will include all document types.

Criteria

Optional variant array of property filter criteria.

OrSearch

Optional Boolean that if set to True specifies a Boolean OR search be performed.

The default is False.

Return Value

Returns a collection of Document Object objects matching the specified parameters.

Remarks

The Criteria parameter can be specified as a single criterion array or as an array of criterion arrays. Each criterion array contains a property name, operator, and an optional value similar to the Find command in PowerUser. For example, Custom.ProjectNr, equals, 2134, where equals is the operator.

The search operators that are supported are those in the IC_OPERATOR constants enumeration. The following table lists the supported operators and the abbreviations, symbols, and constants that may be used:

Search operator options
Operator Abbreviation Symbol Constant

contains, in

C

*

IC_OP_CONTAINS

equals    

IC_OP_DATE_EQUALS

not equal    

IC_OP_DATE_NOT_EQUAL

doswildcard

   

IC_OP_DOSWILDCARD

empty

EM

()

IC_OP_EMPTY

equals, equal

E

EQ =

IC_OP_EQUALS

less

L

<

IC_OP_LESS

less than or equal

LE

<=

IC_OP_LESS_EQUAL

like

LI

%

IC_OP_LIKE

more than

M

>

IC_OP_MORE

more than or equal

ME

>=

IC_OP_MORE_EQUAL

not contains

NC, NOT IN

 

IC_OP_NOT_CONTAINS

not empty

NEM

 

IC_OP_NOT_EMPTY

not equal

NEQ, NE

<>

IC_OP_NOT_EQUAL

not like

NLI, NL

 

IC_OP_NOT_LIKE

not starts with

NSW

 

IC_OP_NOT_STARTSWITH

starts with

SW

 

IC_OP_STARTSWITH

Note:
  • The expression Vault.FindDocuments(<Criteria>).Count will return the number of documents that are found.
  • The expression Vault.FindDocuments(<Criteria>).Properties will return 25 values for each document found without the property names, in no particular order.
  • The expression Vault.FindDocuments(<Criteria>).Document(Document.ID).FileName will return the file name of a document if it matches the specified parameters.
  • If you want to find a document with a specific ID, use the Vault.GetDocument method described in GetDocument method instead. Executing an expression such as Vault.FindDocuments.Document(ID) will cause the server to first create a collection of all documents in the vault and then search within that collection for the document with the specified ID. Such an operation can result in a large load on the server and take an excessive amount of time compared to using the Vault.GetDocument method.
  • For best results when searching on date (day without time) values, use the operators with names that begin with IC_OP_DATE. For date with time (moment) searches, use the other operators.
  • This method can return different results if it is called within the Document_AfterNewDocument event depending on whether Hypertrieve 3 or Hypertrieve 5 is used as the database engine of the vault. If the new document name matches the WildCard parameter, the collection of document IDs returned by a Hypertrieve 5 vault will contain the new document. A Hypertrieve 3 vault will not contain the new document. To make your script compatible with both vault types, it should filter the ID of the new document out of the search results. Similarly, if no results are expected (such as testing for a unique document name) but one document is returned, test whether it is the new document and proceed accordingly.

Example

The following example demonstrates use of the FindDocuments method to display the results of a search executed with the specified parameters.

Sub SearchCount_Execute(Batch)
    Dim StrMask
    StrMask = "*1*.*"
    
    Dim MultipleDocTypes
    MultipleDocTypes = Array("My_Doc_Type", "Hybrid_Doc_Type")

    Dim MultipleCriteria
    MultipleCriteria = Array(_
        Array("Custom.CI",  IC_OP_MORE, 200),_
        Array("Custom.CI",  IC_OP_LESS, 300),_
        Array("Custom.CS",  IC_OP_CONTAINS, "o"),_
        Array("Custom.CStr",  IC_OP_CONTAINS, "iv"),_
        Array("Custom.LOL",  IC_OP_EQUALS, "a-z"),_
        Array("AMVersionablePropertySet._VERSIONNUMBER",  IC_OP_LESS, 2),_
        Array("Custom.CDT",  IC_OP_LESS, (DateSerial(1983,07,12))),_
        Array("NewPS.CB",  IC_OP_EQUALS, False))
        
    Dim bool
    bool = True
    
    Dim Str
    Str = ""

    Dim Document
    
    For Each Document In Vault.FindDocuments(StrMask, MultipleDocTypes, _
        MultipleCriteria, bool)
        str = str &_                  
            " FileName - > " & Document.FileName & vbCrLf &_
            " Document.DocumentType.DisplayName - > " & _
                Document.DocumentType.DisplayName & vbCrLf &_
            " Custom.CI - > " & Document.CI & vbCrLf &_
            " Custom.CS - > " & Document.CS & vbCrLf &_
            " Custom.CStr - > " & Document.CStr & vbCrLf &_
            " Custom.CDT - > " & Document.CDT & vbCrLf &_
            " NewPS.CB - > " & Document.NewPS_CB & vbCrLf &_
            " NewPS.CM - > " & Document.NewPS_CM & vbCrLf &_
            " Custom.LOL  - > " & Document.Custom_LOL & vbCrLf &_
            " Revision - > " & Document.Revision & vbCrLf & vbCrLf
    Next

    WinMsgBox "Total number of documents found is " &_
        Vault.FindDocuments(StrMask, MultipleDocTypes, MultipleCriteria, bool).Count & _
            vbCrLf & vbCrLf & Str
End Sub

ClosedGetDistinctValues Method

Returns the unique values of the specified property.

Syntax

GetDistinctValues(PropertyName As String, MaxValues As Long = -1)
Parameters
Name Description

PropertyName

The name of the property for which to retrieve values.

MaxValues

The maximum number of values to return. The default of -1 returns all values.

Return Value

An array of the values for the specified property.

ClosedGetDocument Method

Returns the document object for a specified ID.

Syntax

GetDocument(ID As String) As IASDocument
Parameters
Name Description
ID

Global ID of the document to retrieve.

Return Value

A Document object.

ClosedGetGroups Method

Returns the names of the current Meridian user groups. For more information about user groups, see Create and Edit User Groups.

Syntax

GetGroups(GroupColumns As Long = 0, [User As String])
Parameters
Name Description

GroupColumns

The number of columns of group information to retrieve. The default of 0 returns all columns.

User

Optional name of the user for which to return groups that the user is a member of.

Return Value

Returns an array of user group information. The dimensions of the array match the number of columns specified for GroupColumns.

ClosedGetPropertyNames Method

Get the property names for the specified property set.

Syntax

GetPropertyNames(PropertySetName As String) As Array
Parameters
Name Description
PropertySetName

Name of the property set from which to return property names.

Return Value

A string array of property names.

ClosedGetUsers Method

Returns the names of the current Meridian user accounts. For more information about user accounts, see Create and Edit User Accounts.

Syntax

GetUsers(UserColumns As Long = 0, [Group As String])
Parameters
Name Description

UserColumns

The number of columns of user information to retrieve. The default of 0 returns all columns.

Group

Optional name of the group for which to return users that are members.

Return Value

Returns an array of user group information. The dimensions of the array match the number of columns specified for UserColumns.

ClosedRootFolder Method

Returns the root folder of a specified scope.

Syntax

Vault(Scope As String).RootFolder
Parameters
Name Description
Scope

The name of the scope for which to return the root folder name.

Return Value

The root folder of the specified scope.

ClosedRunShellCommand Method

Opens a window and passes a specified command line to the operating system to execute. The command may be executed on the application server.

Syntax

RunShellCommand(Command As String, [ShowWindow As IC_SHOWWINDOW As IC_SW_SHOWNORMAL], [AtServer As Boolean = False])
Parameters
Name Description

Command

The command line to execute.

ShowWindow

Optional window style specified as one of the IC_SHOWWINDOW constants.

AtServer

Optional flag to run the command on the server.

ClosedSendNotification Method

Sends a notification email message for a specified object.

Syntax

SendNotification (NotificationName As String, Object As Object)
Parameters
Name Description
NotificationName

The internal name of a notification definition created in Meridian Enterprise Configurator. The internal name can be seen in the tooltip that appears when the mouse cursor is hovered over the notification name.

Object The object about which to send the notification, typically a document object.

Remarks

For information about creating notification definitions, see Configure Event Notifications.

2023