IScheduledTaskPeriodOneTimeOnly.StartDateTime

Syntax

StartDateTime: DateTime;

Description

The StartDateTime property determines the time of the task calculation start. It is actual if the StartMode property is set to TaskPeriodOneTimeStartMode.ByTime.

Example

Executing the example requires that the repository contains a scheduled tasks container with the TASK_CONTAINTER identifier and a module with the Module_1 identifier. The module contains the Main procedure.

Sub Main;

Var

MB: IMetabase;

CrInfo: IMetabaseObjectCreateInfo;

MObj: IMetabaseObject;

Exe: IExecuteSubScheduledTask;

Per: IScheduledTaskPeriodOneTimeOnly;

Prop: IScheduledTaskProperties;

Begin

MB := MetabaseClass.Active;

CrInfo := MB.CreateCreateInfo;

CrInfo.ClassID := MetabaseObjectClass.KE_CLASS_TASK_EXECUTESUB;

CrInfo.Id := "MODULE_EXECUTOR";

CrInfo.Name := "Module execution";

CrInfo.Parent := MB.ItemById("TASK_CONTAINTER");

MObj := MB.CreateObject(CrInfo).Edit;

Exe := MObj As IExecuteSubScheduledTask;

Exe.Assembly := (MB.ItemById("Module_1").Bind As IModule).Assembly;

Exe.SubName := "Main";

Prop := Exe.Properties;

Per := Prop.CreatePeriod(ScheduledTaskPeriodType.OneTimeOnly) As IScheduledTaskPeriodOneTimeOnly;

Per.StartMode := TaskPeriodOneTimeStartMode.ByTime;

Per.StartDateTime := DateTime.ComposeTimeOfDay(12, 0, 0, 0);

Prop.Period := Per;

MObj.Save;

End Sub Main;

After executing the example a new task of module execution is created in the scheduled tasks container. Module will be launched once at 12:00.

See also:

IScheduledTaskPeriodOneTimeOnly