Hi, i have a elemente that i want do create a copy of it with the same parameters and just changing the name, but i need to make it via C# script, because it will only create a copy if i don't have one.
e.g i have a element01 and a elemente01_backup. And i have a elemente02 that don't have a backup, so my script need to copy that element02 and rename it with "_backup"
Someone can help me please?
Hi João,
The easiest way is to use the class library. More information can be found here. Using that library you can retrieve the element, and create a duplicate of it with another name.
var dms = engine.GetDms();
var element = dms.GetElement("elemente02");var duplicateElement = element.Duplicate("elemente02_backup");
Optionally you can also specify on which agent the duplicate element should be created, using the second argument of the Duplicate() method.
var agent = dms.GetAgents().First();
var duplicateElement = element.Duplicate("elemente02_backup", agent);
Thank you Tom Waterbley, it worked as intended!