November Happy Hour will be moved to Thursday December 5th.

Class ScheduledPlugInAttribute

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

Inheritance
System.Object
System.Attribute
ScheduledPlugInAttribute
Implements
System.Runtime.InteropServices._Attribute
Inherited Members
System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo, System.Type)
System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo, System.Type, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo)
System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo, System.Boolean)
System.Attribute.IsDefined(System.Reflection.MemberInfo, System.Type)
System.Attribute.IsDefined(System.Reflection.MemberInfo, System.Type, System.Boolean)
System.Attribute.GetCustomAttribute(System.Reflection.MemberInfo, System.Type)
System.Attribute.GetCustomAttribute(System.Reflection.MemberInfo, System.Type, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo)
System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo, System.Type)
System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo, System.Type, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo, System.Boolean)
System.Attribute.IsDefined(System.Reflection.ParameterInfo, System.Type)
System.Attribute.IsDefined(System.Reflection.ParameterInfo, System.Type, System.Boolean)
System.Attribute.GetCustomAttribute(System.Reflection.ParameterInfo, System.Type)
System.Attribute.GetCustomAttribute(System.Reflection.ParameterInfo, System.Type, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.Module, System.Type)
System.Attribute.GetCustomAttributes(System.Reflection.Module)
System.Attribute.GetCustomAttributes(System.Reflection.Module, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.Module, System.Type, System.Boolean)
System.Attribute.IsDefined(System.Reflection.Module, System.Type)
System.Attribute.IsDefined(System.Reflection.Module, System.Type, System.Boolean)
System.Attribute.GetCustomAttribute(System.Reflection.Module, System.Type)
System.Attribute.GetCustomAttribute(System.Reflection.Module, System.Type, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.Assembly, System.Type)
System.Attribute.GetCustomAttributes(System.Reflection.Assembly, System.Type, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.Assembly)
System.Attribute.GetCustomAttributes(System.Reflection.Assembly, System.Boolean)
System.Attribute.IsDefined(System.Reflection.Assembly, System.Type)
System.Attribute.IsDefined(System.Reflection.Assembly, System.Type, System.Boolean)
System.Attribute.GetCustomAttribute(System.Reflection.Assembly, System.Type)
System.Attribute.GetCustomAttribute(System.Reflection.Assembly, System.Type, System.Boolean)
System.Attribute.Equals(System.Object)
System.Attribute.GetHashCode()
System.Attribute.IsDefaultAttribute()
System.Attribute.System.Runtime.InteropServices._Attribute.GetTypeInfoCount(System.UInt32)
System.Attribute.System.Runtime.InteropServices._Attribute.GetTypeInfo(System.UInt32, System.UInt32, System.IntPtr)
System.Attribute.System.Runtime.InteropServices._Attribute.GetIDsOfNames(System.Guid, System.IntPtr, System.UInt32, System.UInt32, System.IntPtr)
System.Attribute.System.Runtime.InteropServices._Attribute.Invoke(System.UInt32, System.Guid, System.UInt32, System.Int16, System.IntPtr, System.IntPtr, System.IntPtr, System.IntPtr)
System.Attribute.TypeId
System.Object.ToString()
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.PlugIn
Assembly: EPiServer.dll
Version: 9.12.2
Syntax
[AttributeUsage(AttributeTargets.Class)]
public class ScheduledPlugInAttribute : PlugInAttribute, _Attribute
Remarks

The class must implement a public static method with name "Execute", it will be called on the interval specified in administration mode. An 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.
    [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";
}
}

Constructors

ScheduledPlugInAttribute()

Declaration
public ScheduledPlugInAttribute()

Properties

HelpFile

The help page to display for job

Declaration
public string HelpFile { get; set; }
Property Value
Type Description
System.String

InitialTime

Gets or sets the initial time. The format should be parsable to an TimeSpan and will be added to System.DateTime.Today

Declaration
public string InitialTime { get; set; }
Property Value
Type Description
System.String

The initial time.

Remarks

It is only the time part that is used in combination with IntervalType and IntervalLength.

This setting will only be used the first time the scheduled job is initialized.

IntervalLength

Gets or sets the length of the interval. Used in combination with IntervalType and InitialTime to set default value.

Declaration
public int IntervalLength { get; set; }
Property Value
Type Description
System.Int32

The length of the interval.

Remarks

This setting will only be used the first time the scheduled job is initialized.

IntervalType

Gets or sets the type of the interval. Used in combination with IntervalLength and InitialTime to set default value.

Declaration
public ScheduledIntervalType IntervalType { get; set; }
Property Value
Type Description
ScheduledIntervalType

The type of the interval.

Remarks

This setting will only be used the first time the scheduled job is initialized.

Methods

AsyncStart()

Initialization method called by the plug-in system.

Declaration
public static Task AsyncStart()
Returns
Type Description
System.Threading.Tasks.Task

Match(Object)

Matches the specified attribute against this attribute type.

Declaration
public override bool Match(object o)
Parameters
Type Name Description
System.Object o

The object to match.

Returns
Type Description
System.Boolean

True if the object matches this attribute instance.

Overrides
System.Attribute.Match(System.Object)

Start()

Initialization method called by the plug-in system.

Declaration
public static void Start()

Implements

System.Runtime.InteropServices._Attribute

Extension Methods