I am currently trying to clone job tasks programmatically to other Jobs. I have the following code:
var mytask = s.Jobs.GetJobByName("Template Job").Tasks[0];
var myclone = mytask.CloneType();
myclone.Name = "Ping Data Sources Test";
var myjob = s.Jobs.GetJobByName("Target Job");
myjob.Tasks.Add(myclone);
s.Jobs.Tasks.Update(myclone);
s.Jobs.Update(myjob);
This code executes fine, but causes the VC Client to crash (the server is completely fine). The crash happens because of a duplicated ID number. Do I need to generate a new ID number for the cloned task?