Home > ASP.Net, DotNetNuke > Create DNN Schedule in Code

Create DNN Schedule in Code

In one of my previous posts, i described the mechanism to schedule a tasks in DotNetNuke.

DNN provides a user interface to create and manage scheduled tasks (a.k.a Schedule Items), you can access the schedule items by logging in as Host and navigating to Host -> Schedule. You can manage already created schedule items here and you can create new schedule items as well.

But, if you want to create a schedule item in code, following piece of code will help you.

Code: Create Schedule Item

private DotNetNuke.Services.Scheduling.ScheduleItem CreateScheduleItem(
    String friendlyName,
    String typeFullName,
    String objectDependencies,
    int timeLapse,
    String timeLapseMeasurement)
    DotNetNuke.Services.Scheduling.ScheduleItem objScheduleItem =
        new DotNetNuke.Services.Scheduling.ScheduleItem();
    objScheduleItem.FriendlyName = friendlyName;
    //ONLY Supported in 05.02.xx and above versions

    objScheduleItem.TypeFullName = typeFullName;
    objScheduleItem.TimeLapse = timeLapse;
    objScheduleItem.TimeLapseMeasurement = timeLapseMeasurement;
    objScheduleItem.RetryTimeLapse = 1;
    objScheduleItem.RetryTimeLapseMeasurement = "m";
    objScheduleItem.RetainHistoryNum = 100;
    objScheduleItem.AttachToEvent = "";
    objScheduleItem.CatchUpEnabled = false;
    objScheduleItem.Enabled = false;
    objScheduleItem.ObjectDependencies = objectDependencies;
    objScheduleItem.Servers = Null.NullString;
    return objScheduleItem;

Code: Add the Schedule Item to DotNetNuke

DotNetNuke.Services.Scheduling.ScheduleItem item =
CreateScheduleItem("Test Item", "TypeFullName", "", 10, "m");

int scheduleID = 
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: