Showing posts with label How to Delete SPJobDefinition in Sharepoint using Object Model Code. Show all posts
Showing posts with label How to Delete SPJobDefinition in Sharepoint using Object Model Code. Show all posts

Tuesday, 1 July 2014

How to Delete SPJobDefinition in Sharepoint using Object Model Code

const string strFeatureName="My Job";
public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
foreach (SPJobDefinition job in (properties.Feature.Parent as SPWebApplication).JobDefinitions)
{
if (job.Name == strFeatureName)
{ job.Delete(); }
}
}