New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the Community Exchange, where community members ask and answer questions about DNN. To get started, just start typing your question below and either select one of the suggested questions or ask a new question of your own.

Custom Schedule Code is not working

Return to previous page

  • 3/8/2014
  • 2242 Views

Question:

Rashid Bilgrami long time ago

Dear All, 

I have a code for custom schedule code, but when i am unable to run it through scheduler  

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Services.Scheduling;

namespace Reporting_Module.SchedulerClass

{

public class sendEmail: SchedulerClient

{

public sendEmail(ScheduleHistoryItem oItem):base()

{

this.ScheduleHistoryItem = oItem;

}

public override void DoWork()

{

try

{

//--start the pocessing

this.Progressing();

//--call the function/process that you wish to be executed

ExecuteHelloWorld();

//--intimate the schedule mechanism to write log note in schedule history

this.ScheduleHistoryItem.AddLogNote("HelloWorld Service Start. Success.");

this.ScheduleHistoryItem.Succeeded = true;

}

catch (Exception ex) {

this.ScheduleHistoryItem.Succeeded = false;

this.ScheduleHistoryItem.AddLogNote("HelloWorld Service Start. Failed. " + ex.ToString());

this.Errored(ref ex);

DotNetNuke.Services.Exceptions.Exceptions.LogException(ex);

}

}

public void ExecuteHelloWorld()

{

try

{

System.IO.File.WriteAllText(@"D:\\"+ Guid.NewGuid().ToString() + ".txt",

"Hello World. The Time is - " + DateTime.Now.ToString());

}

catch (Exception Ex)

{

throw Ex;

}

}

}

}

Here is my Scheduler settings

Friendly Name:  Send Email

Full Class Name and Assembly:

Reporting_Module.SchedulerClass.sendEmail,Reporting Module

Schedule Enabled:Yes

Time Lapse: 1 sec

Retry Frequency: 1 sec

Retain Schedule History: 100

Run on Event:

Catch Up Enabled: Yes

Object Dependencies:

Run on Servers:

Custom Schedule Code is not working

Rashid Bilgrami
Rashid Bilgrami long time ago
Add an Answer

Answers

Sign In to Participate
Or register to become a member