MailAddress: String;
The MailAddress property determines the email address where the notification about task completion is sent.
NOTE. The property is outdated. Use the MailRecipients property instead.
Executing the example requires that the repository contains a scheduled tasks container with the TASK_CONTAINTER identifier and a regular report with the Report_1 identifier.
Sub Main;
Var
MB: IMetabase;
CrInfo: IMetabaseObjectCreateInfo;
MObj: IMetabaseObject;
CalcReport: ICalculateReportScheduledTask;
Per: IScheduledTaskPeriodOneTimeOnly;
Prop: IScheduledTaskProperties;
Begin
MB := MetabaseClass.Active;
CrInfo := MB.CreateCreateInfo;
CrInfo.ClassID := MetabaseObjectClass.KE_CLASS_TASK_CALCULATEREPORT;
CrInfo.Id := "CALCULATE_REPORT";
CrInfo.Name := "Regular report calculation";
CrInfo.Parent := MB.ItemById("TASK_CONTAINTER");
MObj := MB.CreateObject(CrInfo).Edit;
CalcReport := MObj As ICalculateReportScheduledTask;
CalcReport.FormatTag := "xls";
CalcReport.SourceReport := MB.ItemById("Report_1").Bind As IPrxReport;
Prop := CalcReport.Properties;
Per := Prop.CreatePeriod(ScheduledTaskPeriodType.OneTimeOnly) As IScheduledTaskPeriodOneTimeOnly;
Per.StartMode := TaskPeriodOneTimeStartMode.OnLogon;
Prop.Period := Per;
Prop.MailAddress := "User1@Mail.ru";
MObj.Save;
End Sub Main;
After executing the example a new task of the regular report calculation is created in the scheduled tasks container. The calculation is performed on connecting to repository. Calculation report is sent to the specified email address. Calculated report exported to the XLS format is attached to the letter as an application.
See also: