Class Task
Task class
Represents a task (an iCalendar VTODO component) that can be read from iCalendar and saved to iCalendar or Outlook MSG.
public class Task : IDisposable
Constructors
| Name | Description |
|---|---|
| Task() | The default constructor. |
Properties
| Name | Description |
|---|---|
| Attachments { get; set; } | Gets or sets the files attached to the task. |
| Attendees { get; set; } | Gets or sets the attendees (assignees) of the task. |
| Body { get; set; } | Gets or sets the plain-text body of the task. |
| DueDate { get; set; } | Gets or sets the date by which the user expects work on the task to be complete. |
| HtmlBody { get; set; } | Gets or sets the HTML body of the task. |
| Location { get; set; } | Gets or sets the location of the task. |
| Method { get; set; } | Gets or sets the iTIP method of the task, such as a request or a publication. |
| Organizer { get; set; } | Gets or sets the organizer of the task. |
| PercentComplete { get; set; } | Gets or sets how much of the task is complete, in percent. |
| Priority { get; set; } | Gets or sets the priority of the task. |
| RelatedTo { get; set; } | Gets or sets the unique identifier of a related calendar item (the iCalendar RELATED-TO property). |
| SequenceId { get; set; } | Gets or sets the revision sequence number of the task (the iCalendar SEQUENCE property). |
| StartDate { get; set; } | Gets or sets the start date of the task. |
| Status { get; set; } | Gets or sets the status of the user’s progress on the task. |
| Subject { get; set; } | Gets or sets the subject of the task. |
| UniqueId { get; set; } | Gets or sets the unique identifier of the task (the iCalendar UID property). |
Methods
| Name | Description |
|---|---|
| static Load(Stream) | Loads a task from a stream of iCalendar (ICS) data. |
| static Load(string) | Loads a task from an iCalendar (ICS) file. |
| Dispose() | Releases the resources used by the task, including its attachments. |
| Request() | Creates a task request to send by email. |
| virtual Save(Stream) | Saves the task to a stream in iCalendar (ICS) format. |
| virtual Save(string) | Saves the task to an iCalendar (ICS) file. |
| virtual Save(Stream, TaskSaveOptions) | Saves the task to a stream with the specified options. |
| virtual Save(string, TaskSaveOptions) | Saves the task to a file with the specified options. |
Remarks
A task describes a piece of work to be done: what it is about, when it starts, when it is due, who is responsible for it and how far it has progressed. Unlike an Appointment, it does not occupy a period in a calendar and does not make the owner busy.
Use Load to read a task from an ICS file and Save to write it back, either as iCalendar (TaskIcsSaveOptions) or as an Outlook message (TaskMsgSaveOptions). To send the task by email, add the AlternateView returned by Request to a MailMessage.
The class owns its Attachments, so dispose of an instance when it is no longer needed.
Examples
This example creates a task, assigns it, and saves it to an ICS file.
[C#]
using (var task = new Task())
{
task.Subject = "Review the API documentation";
task.StartDate = new DateTime(2026, 10, 31);
task.DueDate = new DateTime(2026, 11, 7);
task.Status = TaskStatus.InProgress;
task.PercentComplete = 25;
task.Organizer = new MailAddress("organizer@domain.com");
task.Attendees = new MailAddressCollection();
task.Attendees.Add(new MailAddress("assignee@domain.com"));
task.Save("task.ics", new TaskIcsSaveOptions());
}
See Also
- namespace Aspose.Email.Calendar
- assembly Aspose.Email