Microsoft online code analysis framework , as we know i used to analyze the code [.wsp]
My code contains the timer job which is activated via feature. After running the MSOCAF on my WSP , i get warning as :
Implementation of Timer Job
Resolution : FeatureActivated event of SPFeatureReceiver does not contain the definition for job exist check. First verify if there exist any job with the same name. If exists delete the existing job and then use the new.
Code :
// make sure the job isn't already registered
foreach (SPJobDefinition job in site.WebApplication.JobDefinitions)
{
if (job.Name == TASK_LOGGER_JOB_NAME)
{
job.Delete();
break;
}
}
Let me know how to delete job so as to remove the MSOCAF warning.