MailRecipients: IArrayList;
The MailRecipients property determines the emails collection, which are used to sent notifications of task completion.
The collection can contain the following values:
Email address as the string.
Link to the repository user described by the ISecuritySubject.
The MailTargetType property must be specified in settings if the repository users are added to the collection.
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.
See also: