Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9129341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:43:26+00:00 2026-06-17T07:43:26+00:00

I got a SharePoint-Feature under the WebApplication-Scope that should create a Timer-Job. On feature-activation

  • 0

I got a SharePoint-Feature under the WebApplication-Scope that should create a Timer-Job.

On feature-activation (before creating that Job) and on feature-deaktivation I want to delete the job if it already exists. This is the feature-activation-Code:

public class myJob : SPJobDefinition
  public myJob() : base("JobName", SPAdministrationWebApplication.Local, null, SPJobLockType.Job) {}
}

public class JobFeature : SPFeatureReceiver
{
  public override void FeatureActivated(SPFeatureReceiverProperties properties)
  {
    SPWebApplication application = properties.Feature.Parent as SPWebApplication;
    // 1. Delete old Job if exists
    foreach (SPJobDefinition job in application.JobDefinitions)
    {
      if (string.Equals(job.Name, "JobName"))
      {
        job.Delete();   // NEVER GETS HERE
      }
    }
    // 2. Install job
    myJob deploymentJob = new myJob();
    SPMinuteSchedule schedule = new SPMinuteSchedule { BeginSecond = 0, EndSecond = 59, Interval = 5 };
    deploymentJob.Schedule = schedule;
    deploymentJob.Update(); // CRASHES
  }
}

The Problem is: The code that should delete the job is never reached. The job just does not seem to be in application.JobDefinitions. (“// NEVER GETS HERE” in the code above)

But when I try to create the deploymentjob I got an exception that the job already exists (“// CRASHES” in the code above):

{"An object of the type myJob named \"JobName\" already exists under the parent Microsoft.SharePoint.Administration.SPAdministrationWebApplication named \"\".  Rename your object or delete the existing object."}

Where is the error?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T07:43:27+00:00Added an answer on June 17, 2026 at 7:43 am

    When using another constructor it works…

    public myJob(SPWebApplication application)
                : base("JobName", application, null, SPJobLockType.Job)
            {
    
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing a sharepoint feature that should allow only Farm admin to delete
I got a job offer today for a position as a SharePoint developer. One
I am new to SharePoint development and have a question. I got that SharePoint
I'm trying to create a SharePoint application that logs to ULS using a set
I've got a SharePoint site that I'm putting a Silverlight frontend on using the
I've got a silverlight app installed as a web part feature in a sharepoint
I've got a webpart that presents a user on SharePoint with a simple button.
Hallo, i've got a list in a SharePoint-Website (WSS 3.0 SP1) that has a
Hallo, i've got some code that imports documents into a SharePoint (WSS 3.0 SP1)
I've got a SharePoint problem which I need some help with. I'm creating some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.