Learn More





DNN Community Blog

The Community Blog is a personal opinion of community members and by no means the official standpoint of DNN Corp or DNN Platform. This is a place to express personal thoughts about DNNPlatform, the community and its ecosystem. Do you have useful information that you would like to share with the DNN Community in a featured article or blog? If so, please contact .

The use of the Community Blog is covered by our Community Blog Guidelines - please read before commenting or posting.

Creating DotNetNuke Scheduled Jobs

So for a long time now I have been promising an article on creating DotNetNuke Scheduled jobs and finally I'm actually getting it written.  This article is actually the first in a series of two articles.  This one will start out with the programming process involved, and the general "manual" setup process to actually get the job going.  The second article will focus on using the DotNetNuke API's to be able to validate and configure a scheduled job from within a module, making the user setup process easier.

Overview of Scheduled Jobs

Before I get into the specific code for a DotNetNuke scheduled job I want to talk a little bit about what a job is, and how you are going to interact with it.  At a foundation level a DotNetNuke Scheduled Job is simply a class that inherits from the SchedulerClient base class.  As such you override a "DoWork" method that performs whatever custom action you desire.

The base class exposes a ScheduleHistoryItem class that provides a mechanism for your process to report success/failure and a method to report helpful information to users via the "History" reporting that is available within DotNetNuke.

Now, this all seems pretty simple right?  Well there is one common gotcha with scheduled jobs that you want to be aware of, and that is the impacts of the "Scheduler Mode" property within Host Settings.  Now the first question comes to mind is how would that change things, well the key is that if the scheduler is set to "Timer Mode", which is my recommended setting, Scheduled jobs will NOT have access to an HttpContext as they are processing.  This can make file access a bit harder.  In my next article I'll give more details regarding the process to handle this.

General Format

The following is a sample scheduled job class with all comments and custom code removed.

using System; using System.Collections.Generic;

using DotNetNuke.Services.Scheduling;

namespace YourNamespace
public class YourJob : SchedulerClient
public YourJob (ScheduleHistoryItem oItem)
: base()
this.ScheduleHistoryItem = oItem;

public override void DoWork()
//Perform required items for logging

//Your code goes here
//To log note

//Show success
this.ScheduleHistoryItem.Succeeded = true;
catch (Exception ex)
this.ScheduleHistoryItem.Succeeded = false;
InsertLogNote("Exception= " + ex.ToString());
this.Errored(ref ex);

As you can see the format is pretty basic, thee are just a few key items to remember.

  • Always wrap your custom code inside of a Try/Catch block to ensure that you can handle and log the detailed information about any error that might occur
  • To enable logging and to show that your job has truly started, call the Progressing method early in your code
  • Use the available AddLogNote functionality to log additional information that might be helpful.  (For example Records Affected, or other types of diagnostic information)

From here you can build out your scheduled job as needed.

Installing/Configuring the Job

Once you have created your Scheduled Job and installed the dll, either via a module package or some other process, you simply need to add a new item to the DotNetNuke Schedule.  To complete this process you will simply go to "Host" -> "Scheduler" and select the "Add Item to Schedule" option.  The following is an outline of the values that you supply.

  • Full Class Name and Assembly - Your assembly and class name, in the format of FQCN, Assembly (Example YourNamespace.YourJob, YourNamespace where YourNamespace.dll was the compiled project)
  • Schedule Enabled - Check this to enable the item
  • Time Lapse and Retry - To configure the frequency, values you desire
  • Retain History - If set to none, any log writes you do will not be preserved, if using the AddLogNote option, you will want to retain at least a few values.

All of the other items are dependent upon your environment and specific needs.  Once you save the record, your job will be scheduled to execute for the first time.


DotNetNuke scheduled jobs are very simple to build and are a great method to handle batch or offline processing for many needs.  With a bit of planning and logging in place you can handle complex business needs easily.  Feel free to share feedback below.

This blog post is cross-posted from my personal blog.


Adrian Correa Moreno
Forgive my ignorance. Does it also work on DNN 7.2 ?
Adrian Correa Moreno Sunday, February 23, 2014 8:01 AM (link)
sareen kumar
I have a DNN Scheduler in my application which needs to run on every 2 minutes. I noticed that my Scheduler is not running specified time interval (i.e. about 15 mts) in every one hour. My Site application pool alive forever since we are using host-tracker service .
sareen kumar Tuesday, January 06, 2015 12:57 AM (link)
Karthikeyan Kandasamy
It's very useful thank you...

And the another link recommended by me to create and deploy Schedule
Karthikeyan Kandasamy Friday, October 09, 2015 2:20 AM (link)
Karthikeyan Kandasamy
I don't know the work of below two lines. Particularly "this.Errored(ref ex);"
Anybody please let me explain...

this.Errored(ref ex);
Karthikeyan Kandasamy Monday, February 15, 2016 12:53 AM (link)
Roman Yagodin
There is no InsertLogNote method in this sample.
Roman Yagodin Monday, April 18, 2016 3:29 AM (link)

Comment Form

Only registered users may post comments.


2sic Daniel Mettler (125)
Aderson Oliveira (15)
Alec Whittington (11)
Alex Shirley (10)
Andrew Nurse (30)
Anthony Glenwright (5)
Antonio Chagoury (28)
Ash Prasad (22)
Ben Schmidt (1)
Benjamin Hermann (25)
Benoit Sarton (9)
Beth Firebaugh (12)
Bill Walker (36)
Bob Kruger (5)
Brian Dukes (2)
Brice Snow (1)
Bruce Chapman (20)
Bryan Andrews (1)
cathal connolly (55)
Charles Nurse (163)
Chris Hammond (203)
Chris Paterra (55)
Clinton Patterson (28)
Cuong Dang (21)
Daniel Bartholomew (2)
Dave Buckner (2)
David Poindexter (3)
David Rodriguez (2)
Doug Howell (11)
Erik van Ballegoij (30)
Ernst Peter Tamminga (74)
Geoff Barlow (6)
Gifford Watkins (3)
Gilles Le Pigocher (3)
Ian Robinson (7)
Israel Martinez (17)
Jan Blomquist (2)
Jan Jonas (3)
Jaspreet Bhatia (1)
Jenni Merrifield (6)
Joe Brinkman (270)
John Mitchell (1)
Jon Henning (14)
Jonathan Sheely (4)
Jordan Coopersmith (1)
Joseph Craig (2)
Kan Ma (1)
Keivan Beigi (3)
Ken Grierson (10)
Kevin Schreiner (6)
Leigh Pointer (31)
Lorraine Young (60)
Malik Khan (1)
Matthias Schlomann (15)
Mauricio Márquez (5)
Michael Doxsey (7)
Michael Tobisch (3)
Michael Washington (202)
Mike Horton (19)
Mitchel Sellers (28)
Nathan Rover (3)
Navin V Nagiah (14)
Néstor Sánchez (31)
Nik Kalyani (14)
Peter Donker (52)
Philip Beadle (135)
Philipp Becker (4)
Richard Dumas (22)
Robert J Collins (5)
Roger Selwyn (8)
Ruben Lopez (1)
Ryan Martinez (1)
Salar Golestanian (4)
Sanjay Mehrotra (9)
Scott McCulloch (1)
Scott S (11)
Scott Wilkinson (3)
Scott Willhite (97)
Sebastian Leupold (80)
Shaun Walker (237)
Shawn Mehaffie (17)
Stefan Cullmann (12)
Stefan Kamphuis (12)
Steve Fabian (31)
Timo Breumelhof (24)
Tony Henrich (3)
Torsten Weggen (2)
Vicenç Masanas (27)
Vincent Nguyen (3)
Vitaly Kozadayev (6)
Will Morgenweck (37)
Will Strohl (163)
William Severance (5)
Try Evoq
For Free
Start Free Trial
a Demo
See Evoq Live
Need More Information?