IScheduledTaskProperties.MailRecipients

Fore Syntax

MailRecipients: IArrayList;

Fore.NET Syntax

MailRecipients: Prognoz.Platform.Interop.ForeCollections.ArrayList;

Description

The MailRecipients property determines the emails collection, which are used to sent notifications of task completion.

Comments

The collection can contain the following values:

The MailTargetType property must be specified in settings if the repository users are added to the collection.

Fore Example

Executing the example requires that the repository contains a scheduled tasks container with the TASK_CONTAINER identifier. At least one task is created in the container.

Sub UserProc;
Var
    MB: IMetabase;
    Cont: IScheduledTasksContainer;
    Task: IScheduledTask;
    Props: IScheduledTaskProperties;
    Mails: IArrayList;
Begin
    MB := MetabaseClass.Active;
    Cont := MB.ItemById("TASK_CONTAINER").Bind As IScheduledTasksContainer;
    Task := Cont.Tasks.Item(0).Edit As IScheduledTask;
    Props := Task.Properties;
    Mails := Props.MailRecipients;
    //Fixed email
    Mails.Add("User@Example.ru");
    //Email mentioned in user profile
    Mails.Add(MB.LogonSession.User);
    Props.MailTargetType := ScheduledTaskMailTarget.Personal Or ScheduledTaskMailTarget.Work;
    Props.MailRecipients := Mails;
    (Task As IMetabaseObject).Save;
End Sub UserProc;

On executing the example the settings of the first task, created in the container, are changed. Email addresses to which an example execution report is to be sent are specified in the task settings.

Fore.NET Example

Executing the example requires that the repository contains a scheduled tasks container with the TASK_CONTAINER identifier. At least one task is created in the container.

Imports Prognoz.Platform.Interop.ForeCollections;
Imports Prognoz.Platform.Interop.KeFore;
Imports Prognoz.Platform.Interop.Metabase;

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    Cont: IScheduledTasksContainer;
    Task: IScheduledTask;
    Props: IScheduledTaskProperties;
    Mails: ArrayList;
Begin
    MB := Params.Metabase;
    Cont := MB.ItemById["TASK_CONTAINER"].Bind() As IScheduledTasksContainer;
    Task := Cont.Tasks.Item[0].Edit() As IScheduledTask;
    Props := Task.Properties;
    Mails := Props.MailRecipients;
    //Fixed email
    Mails.Add("User@Example.ru");
    //Email mentioned in user profile
    Mails.Add(MB.LogonSession.User);
    Props.MailTargetType := ScheduledTaskMailTarget.stmtPersonal Or ScheduledTaskMailTarget.stmtWork;
    Props.MailRecipients := Mails;
    (Task As IMetabaseObject).Save();
End Sub;

On executing the example the settings of the first task, created in the container, are changed. Email addresses to which an example execution report is to be sent are specified in the task settings.

See also:

IScheduledTaskProperties