EBDN - Community - Question & Answers

  Wednesday, 07 August 2019
  1 Replies
  1.1K Visits
0
Votes
Undo
I would like to know how programmatically copy a Template from "Project template" and create a new project. I am abel to do it through the UI interface in Aucotec.
Manual Steps followed:
I Copy the Project existing Template "XYZ" from the Project Template from Database.
Go to project and paste it the copy gets created as a new project.

Code tried:
ObjectCollection objects_Temp_Proj;
ObjectItem objects_To_Proj;

objects_Temp_Proj = m_myApplication.Folders.ProjectTemplates.Children;
objects_To_Proj = m_myApplication.Folders.Projects;

ObjectItem newEqu_Fol = objects_Temp_Proj[3]; // Template to be copied.
ObjectItem asasas = newEqu_Fol.CopyTo(objects_To_Proj);
asasas.Attributes.FindById(AttributeId.Designation).Value = txtPrjName.Text;
asasas.Store();

Can any one help me out creating the project copying from existing project template.