A plugin to have a scheduled job with a simple user interface in admin mode

Namespace:  EPiServer.PlugIn
Assembly:  EPiServer (in EPiServer.dll) Version: 6.0.530.0

Syntax

C#
[AttributeUsageAttribute(AttributeTargets.Class)]
public class ScheduledPlugInAttribute : PlugInAttribute

Remarks

The class must implement a public static method with name "Execute", it will be called on the interval specified in administration mode. A optional return value can be specified for a descriptive text.

Important! If you change the class or namespace name the old scheduled job will still be active but without a settings page, you should manually delete this job from the database in table tblScheduledItem.

The property HelpFile can be set to link to a custom help page for the job.

Examples

A simple example of a scheduled class, the return type could be void if you don't want to return a descriptive message. Throwing a exception will in this case show up as "FAILED" on the history tab i admin mode.
CopyC#
[ScheduledPlugIn(DisplayName = "My job", Description = "This job is just a sample")]
public class MyJob
{
    public static string Execute()
    {
        if (DateTime.Now.DayOfWeek == DayOfWeek.Sunday)
            throw new Exception("I'm out of office");
        else
            return "I was here";
    }
}

Inheritance Hierarchy

System..::.Object
  System..::.Attribute
    EPiServer.PlugIn..::.PlugInAttribute
      EPiServer.PlugIn..::.ScheduledPlugInAttribute

See Also