IMetabase.CopyObject

Syntax

CopyObject(Info: IMetabaseObjectCopyInfo);

Parameters

Info. Information about copied object.

Description

The CopyObject method copies a repository object according to the information that is passed in the Info parameter.

Comments

The object that is copied is specified in the Source property, and the folder, into which it is copied, is specified in the Destination property of the Info parameter.

Other properties of the Info parameter are not mandatory. If the name and the identifier are not specified, they are generated automatically.

Example

For execution of the example an object with the OBJTEST identifier must be available.

Add a link to the Metabase system assembly.

Sub UserProc;
Var
    MB: IMetabase;
    CInfo: IMetabaseObjectCopyInfo;
Begin
    MB := MetabaseClass.Active;
    CInfo := MB.CreateCopyInfo;
    CInfo.Id := 
"OBJTEST_Copy";
    CInfo.Name := 
"Copy of the OBJTEST object";
    CInfo.WithData := 
True;
    CInfo.Destination := MB.Root;
    CInfo.Source := MB.ItemById(
"OBJTEST");
    MB.CopyObject(CInfo);
End Sub UserProc;

After executing the example the object with the OBJTEST identifier is copied in a repository root. A new object will be named as Copy Of The OBJTEST Object, the OBJTEST_Copy identifier and will save data of a copied object.

See also:

IMetabase | IMetabaseObjectCopyInfo