Hi, how can I inactivate/delete a job using the API?
I tried this but don't work:
//
JobClass jobClassToInactivate = null;
JobClass jobClassToRemove = null;
foreach (JobClass jobClass in server.Jobs.GetAll())
{
if (jobClass.Id == "GuidToInactivate")
{
jobClassToInactivate = jobClass;
}
if (jobClass.Id == "GuidToRemove")
{
jobClassToRemove = jobClass;
}
}
server.Jobs.Inactivate(jobClassToInactivate);
server.Jobs.Remove(jobClassToRemove);
//
the Inactivate method pass, but checking with VCClient the "Activate (when added)" checkbox is checked
and the Remove method throws Null exception even if jobClassToRemove isn't null (jobClassToRemove.Id != null too)
Please what i'm doing wrong? The VC version that i'm using is 4.8.4
Thanks in advance