Class MapiCalendar

MapiCalendar class

Represents an Outlook calendar item: an appointment or a meeting.

public sealed class MapiCalendar : MapiMessageItemBase

Constructors

NameDescription
MapiCalendar()Initializes a new instance of the MapiCalendar class.
MapiCalendar(string, string, string, DateTime, DateTime)Initializes a new instance of the MapiCalendar class that represents an appointment.
MapiCalendar(string, string, string, DateTime, DateTime, MapiElectronicAddress, MapiRecipientCollection)Initializes a new instance of the MapiCalendar class that represents a meeting.
MapiCalendar(string, string, string, DateTime, DateTime, string, MapiRecipientCollection)Initializes a new instance of the MapiCalendar class that represents a meeting.

Properties

NameDescription
AppointmentCounterProposal { get; set; }Gets or sets a value indicating whether a meeting response proposes a new time for the meeting.
Attachments { get; }Gets the attachments of the calendar item.
Attendees { get; set; }Gets or sets the attendees of the meeting.
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.
BusyStatus { get; set; }Gets or sets how the time of the event is shown in the calendar: free, tentative, busy or out of office.
Categories { get; set; }Gets or sets the categories of the item.
ClientIntent { get; set; }Gets or sets the actions the user has taken on the meeting.
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.
EndDate { get; set; }Gets or sets the end date and time of the event. Returns DateTime.MinValue when the date is not set.
EndDateTimeZone { get; set; }Gets or sets the time zone of EndDate.
IsAllDay { get; set; }Gets or sets a value indicating whether the event lasts all day.
virtual ItemId { get; }Gets the identifier of the item on the mail server, for items obtained from a server; null otherwise.
KeyWords { get; set; }Gets or sets the categories of the calendar item.
Location { get; set; }Gets or sets the location of the event.
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.
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.
Organizer { get; set; }Gets or sets the organizer of the meeting.
ProductId { get; set; }Gets or sets the identifier of the product that created the calendar item.
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 event; null for a single event.
ReminderDelta { get; set; }Gets or sets how many minutes before the start of the event the reminder is due.
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.
Sensitivity { get; set; }Gets or sets the sensitivity of the item: normal, personal, private or confidential.
Sequence { get; set; }Gets or sets the sequence number of the meeting, which is increased each time the organizer sends an update.
StartDate { get; set; }Gets or sets the start date and time of the event. Returns DateTime.MinValue when the date is not set.
StartDateTimeZone { get; set; }Gets or sets the time zone of StartDate.
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.
Uid { get; set; }Gets or sets the unique identifier of the event, which links a meeting request, its updates and responses.

Methods

NameDescription
static FromIcs(Stream)Creates an instance of MapiCalendar from the specified stream.
static FromIcs(string)Creates an instance of MapiCalendar from the specified .ics file.
static FromIcs(Stream, bool)Creates an instance of MapiCalendar from the specified stream.
static FromIcs(string, bool)Creates an instance of MapiCalendar from the specified .ics file.
static Load(Stream)Loads a MapiCalendar from the specified stream.
static Load(string)Loads a MapiCalendar from the specified file.
override Dispose()Releases all resources used by the calendar 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 the calendar item to a stream in iCalendar format with the default options.
Save(string)Saves the calendar item to an iCalendar (.ics) file with the default options.
Save(Stream, AppointmentSaveFormat)Saves the calendar item to a stream in the specified format with the default options.
Save(Stream, MapiCalendarSaveOptions)Saves the calendar item to a stream with the specified options.
Save(string, AppointmentSaveFormat)Saves the calendar item to a file in the specified format with the default options.
Save(string, MapiCalendarSaveOptions)Saves the calendar item to a file with the specified options.
SaveAsync(Stream, CancellationToken)Saves calendar object to the file with iCalendar format using the default save options asynchronously.
SaveAsync(string, CancellationToken)Saves calendar object to the file with iCalendar format using the default save options asynchronously.
SaveAsync(Stream, AppointmentSaveFormat, CancellationToken)Saves calendar object to the stream with specified format using the default save options asynchronously.
SaveAsync(Stream, MapiCalendarSaveOptions, CancellationToken)Saves calendar to the stream with specified save options asynchronously.
SaveAsync(string, AppointmentSaveFormat, CancellationToken)Saves calendar object to the file with specified format using the default save options asynchronously.
SaveAsync(string, MapiCalendarSaveOptions, CancellationToken)Saves calendar to the file with specified save options asynchronously.
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.
SetStateForced(MapiCalendarState)Sets the state of the calendar object, overriding any default behavior.
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 FromIcsAsync(Stream, CancellationToken)Creates an instance of MapiCalendar from the specified stream asynchronously.
static FromIcsAsync(string, CancellationToken)Creates an instance of MapiCalendar from the specified .ics file asynchronously.
static FromIcsAsync(Stream, bool, CancellationToken)Creates an instance of MapiCalendar from the specified stream asynchronously.
static FromIcsAsync(string, bool, CancellationToken)Creates an instance of MapiCalendar from the specified .ics file asynchronously.
static LoadAsync(Stream, CancellationToken)Loads a MapiCalendar from the specified stream asynchronously.
static LoadAsync(string, CancellationToken)Loads a MapiCalendar from the specified file asynchronously.

Remarks

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

Examples

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

[C#]

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

// Check if the loaded message is a supported calendar type
if (msg.SupportedType == MapiItemType.Calendar)
{
    // Convert the MAPI message to a MapiCalendar object
    var mapiCalendar = (MapiCalendar)msg.ToMapiMessageItem();
    
    // Display some calendar info
    Console.WriteLine(mapiCalendar.Subject);
    Console.WriteLine(mapiCalendar.StartDate);
}

[Visual Basic]

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

' Check if the loaded message is a supported calendar type
If msg.SupportedType = MapiItemType.Calendar Then
    ' Convert the MAPI message to a MapiCalendar object
    Dim mapiCalendar = DirectCast(msg.ToMapiMessageItem(), MapiCalendar)
    
    ' Display some calendar info
    Console.WriteLine(mapiCalendar.Subject)
    Console.WriteLine(mapiCalendar.StartDate)
End If

See Also