Class MapiTask

MapiTask class

Represents a MAPI task item.

public class MapiTask : MapiMessageItemBase

Constructors

NameDescription
MapiTask()Initializes a new instance of the MapiTask class.
MapiTask(string, string, DateTime, DateTime)Initializes a new instance of the MapiTask class with a subject, a body and dates.

Properties

NameDescription
AcceptanceState { get; set; }Gets or sets whether the assignee has accepted or rejected the task.
ActualEffort { get; set; }Gets or sets the time actually spent on the task, in minutes.
Attachments { get; }Gets the attachments of the task.
Billing { get; set; }Gets or sets the billing information of the item.
Body { get; set; }Gets or sets the plain-text body of the item.
BodyHtml { get; }Gets the body of the item as HTML, converted from BodyRtf; an empty string when there is no RTF body.
BodyRtf { get; set; }Gets or sets the body of the item in RTF format.
BodyType { get; }Gets the format of the body: plain text, HTML or RTF.
Categories { get; set; }Gets or sets the categories of the item.
virtual CodePage { get; }Gets the code page of the ANSI strings of the object.
Companies { get; set; }Gets or sets the names of the companies associated with the item.
DateCompleted { get; set; }Gets or sets the date the work on the task was completed.
DueDate { get; set; }Gets or sets the date the task is due.
EstimatedEffort { get; set; }Gets or sets the expected time of work on the task, in minutes.
Flags { get; }Gets the flags of the task, such as complete or recurring.
History { get; set; }Gets or sets the last change made to the task.
virtual ItemId { get; }Gets the identifier of the item on the mail server, for items obtained from a server; null otherwise.
LastUpdate { get; set; }Gets or sets the date and time of the last change made to the task.
MessageClass { get; set; }Gets or sets the message class of the item, such as IPM.Note for an e-mail message. The class determines the type of the item.
Mileage { get; set; }Gets or sets the mileage information of the item.
Mode { get; set; }Gets or sets the assignment status of the task.
NamedProperties { get; }Gets the named properties of the item.
NamedPropertyMapping { get; }Gets the mapping between the named properties and the tags they are stored under.
PercentComplete { get; set; }Gets or sets the progress of the task, from 0 to 100 percent.
Priority { get; set; }Gets or sets the priority of the task.
virtual Properties { get; }Gets all properties of the object.
PropertyStream { get; }Gets the property stream of the item.
Recipients { get; set; }Gets or sets the recipients of the item.
Recurrence { get; set; }Gets or sets the recurrence of the task; null for a single task.
ReminderFileParameter { get; set; }Gets or sets the full path of the sound file that is played when the reminder is due.
ReminderSet { get; set; }Gets or sets a value indicating whether a reminder is set.
ReminderTime { get; set; }Gets or sets the date and time of the reminder.
Sensitivity { get; set; }Gets or sets the sensitivity of the item: normal, personal, private or confidential.
StartDate { get; set; }Gets or sets the date the work on the task starts.
State { get; set; }Gets or sets the assignment state of the task.
Status { get; set; }Gets or sets the progress status of the task: not started, in progress, complete and so on.
Subject { get; set; }Gets or sets the subject of the message.
SubjectPrefix { get; }Gets the prefix of the subject, such as RE: or FW: .
SubStorages { get; }Gets the sub-storages of the item.
SupportedType { get; }Gets the type of the item, as determined by its message class.
Users { get; set; }Gets or sets the people involved in the task: owner, assigner, delegator and so on.

Methods

NameDescription
static FromVTodo(Stream)Loads a task from a stream that contains an iCalendar VTODO.
static FromVTodo(string)Loads a task from an iCalendar (.ics) file with a VTODO.
static FromVTodo(Stream, bool)Loads a task from a stream that contains an iCalendar VTODO, optionally detecting the encoding.
static FromVTodo(string, bool)Loads a task from an iCalendar (.ics) file with a VTODO, optionally detecting the encoding.
static Load(Stream)Loads a MapiTask from the specified stream.
static Load(string)Loads a MapiTask from the specified file.
virtual Dispose()Releases the resources used by the item.
override GetProperty(PropertyDescriptor)Gets a MAPI property of the item by its descriptor.
GetPropertyBoolean(long)Gets the value of a property as a Boolean.
GetPropertyBytes(long)Gets the value of a property as bytes.
GetPropertyDateTime(long)Gets the value of a property as a date and time.
GetPropertyInt32(long)Gets the value of a property as a 32-bit integer.
GetPropertyLong(long)Gets the value of a property as a 64-bit integer.
GetPropertyShort(long)Gets the value of a property as a 16-bit integer.
GetPropertyString(long)Gets the value of a property as a string.
GetPropertyString(long, int)Gets the value of a property as a string, decoding an ANSI string with the specified code page.
GetUnderlyingMessage()Retrieves the underlying MapiMessage object.
IsStoreUnicodeOk()Determines whether the string properties of the object are stored in Unicode.
RemoveProperty(long)Removes a property from the item, including its named-property mapping.
Save(Stream)Saves this MapiTask to the given stream.
Save(string)Saves this MapiTask to the given file.
Save(Stream, TaskSaveFormat)Saves the task to a stream in the specified format. Only MSG is supported.
Save(string, TaskSaveFormat)Saves the task to a file in the specified format. Only MSG is supported.
SaveAsync(Stream, CancellationToken)Saves this MapiTask to the given stream asynchronously. The supported save format is MSG.
SaveAsync(string, CancellationToken)Saves this MapiTask into file asynchronously. The supported save format is MSG.
SaveAsync(Stream, TaskSaveFormat, CancellationToken)Saves this MapiTask to the given stream using specified format asynchronously. The supported save format is MSG.
SaveAsync(string, TaskSaveFormat, CancellationToken)Saves this MapiTask into file using specified format asynchronously. The supported save format is MSG.
virtual SetBodyContent(string, BodyContentType)Sets the body of the item in the specified format.
virtual SetBodyContent(string, BodyContentType, bool)Sets the body of the item in the specified format, optionally compressing it.
SetBodyRtf(string, bool)Sets the body of the item in RTF format, optionally compressing it.
SetMessageFlags(MapiMessageFlags)Sets the flags of the message, such as read or unsent.
virtual SetProperty(MapiProperty)Adds the property, or replaces the property with the same tag.
override SetProperty(PropertyDescriptor, object)Sets the value of a MAPI property of the item.
TryGetPropertyData(long)Gets the value of a property as bytes.
TryGetPropertyDateTime(long, ref DateTime)Gets the value of a property as a date and time, if the property exists.
TryGetPropertyInt32(long, ref int)Gets the value of a property as a 32-bit integer, if the property exists.
TryGetPropertyLong(long, ref long)Gets the value of a property as a 64-bit integer, if the property exists.
TryGetPropertyString(long)Gets the value of a property as a string.
TryGetPropertyString(long, int)Gets the value of a property as a string, decoding an ANSI string with the specified code page.
TryGetPropertyString(long, ref string)Gets the value of a property as a string, if the property exists.
TryGetPropertyString(long, ref string, int)Gets the value of a property as a string, if the property exists, decoding an ANSI string with the specified code page.
static FromVTodoAsync(Stream, CancellationToken)Creates an instance of MapiTask from the specified stream asynchronously.
static FromVTodoAsync(string, CancellationToken)Creates an instance of MapiTask from the specified .ics file asynchronously.
static FromVTodoAsync(Stream, bool, CancellationToken)Creates an instance of MapiTask from the specified stream asynchronously.
static FromVTodoAsync(string, bool, CancellationToken)Creates an instance of MapiTask from the specified .ics file asynchronously.
static LoadAsync(Stream, CancellationToken)Loads a MapiTask from the specified stream asynchronously.
static LoadAsync(string, CancellationToken)Loads a MapiTask from the specified file asynchronously.

Remarks

This class serves as a wrapper for MapiMessage to simplify the process of handling task information from MAPI properties. It provides a more intuitive interface for accessing and manipulating task data within the MAPI message.

Examples

The following example demonstrates how to get a MapiTask object from a MapiMessage.

[C#]

var msg = MapiMessage.Load("task.msg");

// Check if the loaded message is a supported task type
if (msg.SupportedType == MapiItemType.Task)
{
    // Convert the MAPI message to a MapiTask object
    var mapiTask = (MapiTask)msg.ToMapiMessageItem();
    
    // Display some task info
    Console.WriteLine(mapiTask.Subject);
    Console.WriteLine(mapiTask.DueDate);
}

[Visual Basic]

Dim msg = MapiMessage.Load("task.msg")

' Check if the loaded message is a supported task type
If msg.SupportedType = MapiItemType.Task Then
    ' Convert the MAPI message to a MapiTask object
    Dim mapiTask = DirectCast(msg.ToMapiMessageItem(), MapiTask)
    
    ' Display some task info
    Console.WriteLine(mapiTask.Subject)
    Console.WriteLine(mapiTask.DueDate)
End If

See Also