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: