MetaFile

The MetaFile object represents the physical Metadata file and is used to load and save the Metadata from and to the file system. It also publishes the MetaJob object, which is the root node of the Metadata structure.

The MetaFile object is the only object that is formally published to the user. All the other objects are obtained, directly or indirectly, through methods of this object.

A standalone, empty MetaFile object can be created using CreateObject("MetadataLib.MetaFile") in any script program, even outside of Workflow, or the {145E89F9-C2DF-4604-821A-9BD6C4B468DA} CLSID with CoCreateInstance.

The current job's Metadata file name can be obtained using the Watch.GetMetadataFilename method (see Watch.GetMetadataFilename) when using the Run Script task. Note that the exact syntax may vary according to the selected script language.
When writing a plugin using the plugin SDK the current job's Metadata file name can be obtained by calling the IWatchJob::MetadataFilename method from within IWatchPlugin::Execute.

Under no circumstances should any other objects of this library be created directly. Always use the published APIs to create new objects.
The Metadata objects point to an underlying persistent data store. This means that if there are live references to Metadata objects and the underlying data is destroyed (e.g. a new file is loaded), the objects would point to invalid data. The effect of calling any object method in these circumstances is undefined and may result in memory corruption, crash or loss of data.

Methods

Name Description
Job() Returns the MetaJob node, which sits at the top of the Metadata tree structure.
LoadFromFile(const String Filename ) Loads a Metadata file from the file system.
SaveToFile(const String Filename) Saves a Metadata file to the file system.
Export(const String Filename, TExportFormat Format) Exports the Metadata in a non-native format.

LoadFromFile(const String Filename )

Loads a Metadata file from the file system. This function throws an error when the Metadata file is invalid or when it can't be found. Note that this error should be caught in a try-catch block.

Filename

Name of the file to load.

Exceptions

  • EOleException: Invalid Metadata file or other error while loading.

SaveToFile(const String Filename)

Saves the current Metadata structure in a file.

Filename

Name of the file to save into. If the file already exists, the file is overwritten and its current contents is lost.

Export(const String Filename, TExportFormat Format)

Exports the Metadata in a non-native format.

Filename

Name of the file to save to. If the file already exists, the file is overwritten and its current content is lost.

Format

Format in which to save the file. The only value currently supported is efXml21 (value = 0), which is an XML format corresponding to the former Metadata native file format.

Exceptions

  • EOleException: The specified export format is invalid.