Create Task
The Create Task demo application demonstrates how to create a Task using EWS.
Example code:
EWSSession.Active := True;
try
NewTask := EWSSession.CreateMessage(dfinTasks) as IRwEWSTask;
NewTask.Subject := edtSubject.Text;
NewTask.Status := TTaskStatus(cmbBxStatus.ItemIndex);
NewTask.IsPrivate := chBxPrivate.Checked;
case cmBxPriority.ItemIndex of
0 : NewTask.Importance := icLow;
1 : NewTask.Importance := icNormal;
2 : NewTask.Importance := icHigh;
end;
NewTask.ReminderIsSet := chBxReminder.Checked;
if chBxReminder.Checked then
NewTask.ReminderDueBy := RwLocalToUTC(Trunc(dtPckReminderDate.Date) + dtPckReminderTime.Time);
if dtPckStartDate.DateTime > 0 then
NewTask.StartDate := Trunc(dtPckStartDate.DateTime);
if dtPckDueDate.DateTime > 0 then
NewTask.DueDate := Trunc(dtPckDueDate.DateTime);
NewTask.SaveChanges();
finally
EWSSession.Active := False;
end;
Screenshot:
![]() |