CopyObject(Info: IMetabaseObjectCopyInfo);
CopyObject(Info: Prognoz.Platform.Interop.Metabase.IMetabaseObjectCopyInfo);
Info. Information about copied object.
The CopyObject method copies a repository object according to the information that is passed in the Info parameter.
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.
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;
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
CInfo: IMetabaseObjectCopyInfo;
Begin
MB := Params.Metabase;
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;
After executing this 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: