ICustomProperties.Add

Syntax

Add(Id: String; Name: String; Value: Variant): ICustomProperty;

Parameters

Id. Custom property identifier.

Name. Custom property name.

Value. Custom property value.

Description

The Add method creates a new custom property.

Example

Executing the example requires that the repository contains an object with the OBJECT identifier.

Add a link to the Metabase system assembly.

Sub Main;
Var
    Mb: IMetabase;
    Obj: IMetabaseObjectDescriptor;
    Upd: IMetabaseUpdate;
    Nd: IMetabaseUpdateObjectNode;
    RootFolder: IMetabaseUpdateFolderNode;
    NdFol: IMetabaseUpdateFolderNode;
Begin
    // Get the current repository
    Mb := MetabaseClass.Active;
    // Create an update object
    Upd := Mb.CreateUpdate;
    // Get custom classes container with the OBJECT identifier
    Obj := Mb.ItemById("OBJECT").Bind;
    // Create an update structure object
    RootFolder := Upd.RootFolder;
    // Add object to update
    Nd := RootFolder.Add(MetabaseUpdateNodeType.Object) As IMetabaseUpdateObjectNode;
    Nd.Object := Obj;
    // Create a new custom property
    Nd.CustomProperties.Add("CREATENEWPROPERTY""ITEM""NEWPROPERTY");
    // Save update to file
    Upd.SaveToFileNF("C:\Update.pefx");
End Sub Main;

After executing the example, an update containing the object with the OBJECT identifier is created. A new custom property is added to object metadata, and update is saved to the C:\Update.pefx file.

See also:

ICustomProperties