IScheduledTaskProperties.MailRecipients

Syntax

MailRecipients: IArrayList;

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.

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.

Add links to the Collections, Fore, and Metabase system assemblies.

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 specified in user profile
    Mails.Add(MB.LogonSession.User);
    Props.MailTargetType := ScheduledTaskMailTarget.Personal Or ScheduledTaskMailTarget.Work;
    Props.MailRecipients := Mails;
    // Copy and blind copy
    Props.CopyMailRecipients := "User1@Example.ru";
    Props.HiddenMailRecipients := "User2@Example.ru";
    (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 a task execution report will be sent, are specified in the task settings.

See also:

IScheduledTaskProperties