Disasterkid Disasterkid -4 years ago 134
C# Question

Can JobKey be changed? How?

What are the dangers of changing a

without tampering with its schedule? And how can we do it? I suppose we should change the associated triggers with it as well, right?

Answer Source

It would be a different job so you would have to:

  • Retrieve the job with the old JobKey and call scheduler.DeleteJob(key) since you want both the JobDetail and Trigger removed.
  • Reschedule with your new JobKey and the old schedule.

However, since a campaign has an Id you can use that as a JobKey, the assumption here being that an Id will not change. If it's important for users to identify jobs by their campaign name, you can build a new JobDetail with similar parameters as the existing one, but change the Description to match the new campaign name and then call:

 scheduler.AddJob(jobDetail, true)

which should replace the old JobDetail with the new one.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download