Using scripting objects |
Like the client-side classes, scripting classes can help simplify some programming tasks. But be aware, the classes have been optimized for use from VBScript and require proper initialization; otherwise a run-time error (exception) will be generated.
The central class of the SDK scripting model is the BCSMetadata class that allows you to instantiate other script classes (like the BCRepository class provides instantiation of server-side classes).
Before using a scripting object, you must create and initialize the BCSMetadata object with BCServiceProvider object as a parameter in the constructor.
The following example shows how to read values from a table in a standalone application.
Imports BlueCieloECM.InnoCielo.Meridian.Scripting ' Your code goes here... Private Sub DoIt2(ByVal repository As BCRepository) ' Create context for script objects. Using sp As BCServiceProvider = New BCServiceProvider(repository) ' Create a metadata for script objects. Using smd As BCSMetadata = New BCSMetadata(sp) ' Get table with name "MyTable" Using table As BCSTable = smd.Vault.Table("GCFShares") Dim values As Object(,) ' Search a row with "The first row" value in column "StringColumn". values = table.GetValues("ShareName", "Dima2005") ' If the row found, show a value of the second column. If values.Length > 0 Then MessageBox.Show("Value: " + values(1, 0).ToString()) End If End Using End Using End Using End Sub
In order to use either a BCSDocument or BCSFolder object, you must initialize BCSMetadata with the BCServiceProvider object and the proper BCFSObject. The following example shows how to get the Web Access URL of a document in a stand-alone application.
Imports BlueCieloECM.InnoCielo.Meridian.Scripting ' Your code goes here... Private Sub DoIt3(ByVal repository As BCRepository) ' Get a document. Using doc As BCDocument = repository.GetFSObject(repository.PathToID("\collab.doc")) ' Create context for script objects. Using sp As BCServiceProvider = New BCServiceProvider(repository) ' Create a metadata for script objects. Using smd As BCSMetadata = New BCSMetadata(sp, doc) Using sdoc As BCSDocument = smd.Document MessageBox.Show("Web Access location: " + smd.Vault.ComposeURL(sdoc)) End Using End Using End Using End Using End Sub
In a user interface extension, scripting objects are initialized by the host application and accessible via the ExtensionHost.ScriptObjects property. It replaces the Visual Basic 6 designer API and provides the same functionality as DocumentDetails, FolderDetails, ClientDetails, and VaultDetails properties of the AMUIExtension object.