Nik -
Much appreciated, thanks. I've set this up now in another class in my module:
Namespace TT.Modules.Emailer
Public Class EmailerSchedule
Inherits DotNetNuke.Services.Scheduling.SchedulerClient
Public Sub New(ByVal objScheduleHistoryItem As DotNetNuke.Services.Scheduling.ScheduleHistoryItem)
MyBase.new()
Me.ScheduleHistoryItem = objScheduleHistoryItem
End Sub
Public Overrides Sub DoWork()
Try
' Code to do something goes here
SendEmail()
Me.ScheduleHistoryItem.Succeeded = True
Me.ScheduleHistoryItem.AddLogNote("Completed Emailer schedule")
Catch ex As Exception
Me.ScheduleHistoryItem.Succeeded = False
Me.ScheduleHistoryItem.AddLogNote("EXCEPTION: " & ex.Message)
Me.Errored(ex)
LogException(ex)
End Try
End Sub
Private Sub SendEmail()
Me.Status = "Sending Email"
' do the job
Me.Status = "Sent Email"
Me.ScheduleHistoryItem.AddLogNote("Completed Emailer schedule")
Me.ScheduleHistoryItem.Succeeded = True
End Sub
End Class
End Namespace
I added the Scheduler manually like this in Host > Schedule:
Full Class Name and Assembly: TT.Modules.Emailer.EmailerSchedule,TT.Modules.Emailer
Enabled: Yes
Time Elapsed: 2 Mins
Retry Frequency: 5 Mins
Retain Schedule History: All
Run on Event: None
Catch Up Enabled: Yes
Object Dependencies:
Run on Servers:
I edited web.config and set the schedule debug="true" as per the scheduler docs. This then added some stuff to events:
EVENT ADDED TO PROCESS GROUP 0: TT.Modules.Emailer.EmailerSchedule,TT.Modules.Emailer
SCHEDULE ID: 10
Server Name: MyBox
But, there is no schedule history. Where does Me.ScheduleHistoryItem.AddLogNote() write to?
I think this is very close now because it looks like I added it correctly, just nothing being logged.
Thanks again