MessageType Class

Definition

The MessageType class represents an Exchange e-mail message in a mailbox.

public ref class MessageType : ExchangeWebServices::ItemType
public class MessageType : ExchangeWebServices.ItemType
Public Class MessageType
Inherits ItemType
Inheritance
MessageType
Derived

Examples

The following code example shows how to create a message. Note that a message that is returned in a response will have many other properties that are set by the Exchange server.

static MessageType CreateMessage()
{ 
    // Create a meesage.
    MessageType <span class="label">message</span> = new MessageType();

    // Add recipients to message.
<span class="label">message</span>.ToRecipients = new EmailAddressType[2];
<span class="label">message</span>.ToRecipients[0] = new EmailAddressType();
<span class="label">message</span>.ToRecipients[0].EmailAddress = "user1@example.com";
<span class="label">message</span>.ToRecipients[1] = new EmailAddressType();
<span class="label">message</span>.ToRecipients[1].EmailAddress = "user2@example.com";
<span class="label">message</span>.CcRecipients = new EmailAddressType[1];
<span class="label">message</span>.CcRecipients[0] = new EmailAddressType();
<span class="label">message</span>.CcRecipients[0].EmailAddress = "user3@example.com";
<span class="label">message</span>.BccRecipients = new EmailAddressType[1];
<span class="label">message</span>.BccRecipients[0] = new EmailAddressType();
<span class="label">message</span>.BccRecipients[0].EmailAddress = "user4@example.com";

    // Compose e-mail message.
<span class="label">message</span>.Subject = "High Priority Projects for Q3";
<span class="label">message</span>.Body = new BodyType();
<span class="label">message</span>.Body.BodyType1 = BodyTypeType.HTML;
<span class="label">message</span>.Body.Value = "&lt;html&gt;&lt;body style='font-family: Arial'&gt;&lt;ul&gt;" +
     "&lt;li&gt;Create budget for next fiscal year.&amp;nbsp;&lt;/li&gt;" + 
     "&lt;li&gt;Hiring updates.&amp;nbsp;&lt;/li&gt;" + 
     "&lt;li&gt;Design plan for new facilities.&lt;/li&gt;" + 
     "&lt;li&gt;Identify new opportunities for operational efficiency.&amp;nbsp;&lt;/li&gt;" +
     "&lt;/ul&gt;&lt;p&gt;Please provide feedback before the meeting.&amp;nbsp;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;";
<span class="label">message</span>.Sensitivity = SensitivityChoicesType.Confidential;
<span class="label">message</span>.SensitivitySpecified = true;
<span class="label">message</span>.Categories = new string[2] { "Planning", "FiscalYear_Next" };
<span class="label">message</span>.Importance = ImportanceChoicesType.High;
<span class="label">message</span>.ImportanceSpecified = true;

    return <span class="label">message</span>;
}

Remarks

The MessageType class has many members that are read-only but that have a setter for the property. This is an artifact from the definition in the schema file. For example, the IsRead property cannot be set when you are creating a message. This property is returned when a message item is received in a response from the computer that is running Exchange Server 2007.

You do not have to set the ItemClass property on the MessageType object unless you want to create a custom subtype of IPM.Note. The Exchange server handles the MessageType as an IPM.Note.

MessageType objects represent e-mail messages and all other items that are not strongly typed by the Exchange Web Services (EWS) schema. Items such as IPM.Sharing and IPM.InfoPath are returned as MessageType objects. Versions of Exchange Server starting with Exchange 2010 and Exchange Online do not return the base ItemType object in responses.

Constructors

MessageType()

The MessageType constructor initializes a new instance of the MessageType class.

Properties

ArchiveTag (Inherited from ItemType)
Attachments

The Attachments property gets or sets an AttachmentType array that contains the items or files that are attached to an item in the Exchange store.

(Inherited from ItemType)
BccRecipients

The BccRecipients property gets or sets a collection of recipients that receive a blind carbon copy (Bcc) of an e-mail. This property is optional. This is a read/write property.

BlockStatus (Inherited from ItemType)
BlockStatusSpecified (Inherited from ItemType)
Body

The Body property contains the body content of an item.

(Inherited from ItemType)
Categories

The Categories property gets or set a string array that identifies the categories to which an item in the mailbox belongs.

(Inherited from ItemType)
CcRecipients

The CcRecipients property gets or sets a collection of recipients that receive a carbon copy (Bcc) of an e-mail. This property is optional. This is a read/write property.

ConversationId (Inherited from ItemType)
ConversationIndex

The ConversationIndex property gets or sets the identifier to the thread to which the message belongs. This property is optional. This is a read/write property.

ConversationTopic

The ConversationTopic property gets or sets the conversation identifier. This property is optional. This is a read/write property.

Culture

The Culture property gets or sets the culture for a given item in a mailbox.

(Inherited from ItemType)
DateTimeCreated

The DateTimeCreated property gets or sets the date and time that an item in the mailbox was created.

(Inherited from ItemType)
DateTimeCreatedSpecified

The DateTimeCreatedSpecified property gets or sets a Boolean value that specifies whether the DateTimeCreated property is serialized into the SOAP request. This property is required if the DateTimeCreated property is specified.

(Inherited from ItemType)
DateTimeReceived

The DateTimeReceived property gets the date and time that an item in a mailbox was received.

(Inherited from ItemType)
DateTimeReceivedSpecified

The DateTimeReceivedSpecified property gets or sets a Boolean value that specifies whether the DateTimeReceived property is serialized into the SOAP request. This property is required if the DateTimeReceived property is specified.

(Inherited from ItemType)
DateTimeSent

The DateTimeSent property gets or sets the date and time when an item in a mailbox was sent.

(Inherited from ItemType)
DateTimeSentSpecified

The DateTimeSentSpecified property gets or sets a Boolean value that specifies whether the DateTimeSent property is serialized into the SOAP request. This property is required if the DateTimeSent property is specified.

(Inherited from ItemType)
DisplayCc

The DisplayCc property gets or sets the display string that is used for the contents of the Cc box. This is the concatenated string of all Cc recipient display names.

(Inherited from ItemType)
DisplayTo

The DisplayTo property gets or sets the display string that is used for the contents of the To box. This is the concatenated string of all To recipient display names.

(Inherited from ItemType)
EffectiveRights

The EffectiveRights property gets or sets an instance of the EffectiveRightsType class that represents the client's rights based on the permission settings for the item or folder.

(Inherited from ItemType)
EntityExtractionResult (Inherited from ItemType)
ExtendedProperty

The ExtendedProperty property gets or sets an array of the type ExtendedPropertyType that identifies extended MAPI properties.

(Inherited from ItemType)
Flag (Inherited from ItemType)
From

The From property gets or sets the addressee from whom the message was sent. This property is optional. This is a read/write property.

GroupingAction (Inherited from ItemType)
GroupingActionSpecified (Inherited from ItemType)
HasAttachments

The HasAttachments property gets or sets a Boolean value that indicates whether the item has at least one attachment.

(Inherited from ItemType)
HasAttachmentsSpecified

The HasAttachmentsSpecified property gets or sets a Boolean value that specifies whether the HasAttachments property is serialized into the SOAP request. This property is required if the HasAttachments property is specified.

(Inherited from ItemType)
HasBlockedImages (Inherited from ItemType)
HasBlockedImagesSpecified (Inherited from ItemType)
IconIndex (Inherited from ItemType)
IconIndexSpecified (Inherited from ItemType)
Importance

The Importance property gets or sets one of the valid ImportanceChoicesType values to indicate the importance of the item.

(Inherited from ItemType)
ImportanceSpecified

The ImportanceSpecified property gets or sets a Boolean value that specifies whether the Importance property is serialized into theSOAP request. This property is required if the Importance property is specified.

(Inherited from ItemType)
InReplyTo

The InReplyTo property gets or sets a string value that contains the identifier of the item to which this item is a reply.

(Inherited from ItemType)
InstanceKey (Inherited from ItemType)
InternetMessageHeaders

The InternetMessageHeaders property gets or sets an array of the type InternetHeaderType that represents the collection of all Internet message headers that are contained in an item in a mailbox.

(Inherited from ItemType)
InternetMessageId

The InternetMessageId property gets or sets the Internet message identifier for the message. This property is optional. This is a read/write property.

IsAssociated (Inherited from ItemType)
IsAssociatedSpecified (Inherited from ItemType)
IsDeliveryReceiptRequested

The IsDeliveryReceiptRequested property gets or sets a Boolean value that specifies whether the sender of the item requests a delivery receipt. This property is optional. This is a read/write property.

IsDeliveryReceiptRequestedSpecified

The IsDeliveryReceiptRequestedSpecified property gets or sets a Boolean value that specifies whether the IsDeliveryReceiptRequested property is serialized into the Simple Object Access Protocol (SOAP) request. This property is required if the IsDeliveryReceiptRequested property is specified. This is a read/write property.

IsDraft

The IsDraft property gets or sets a Boolean value that indicates whether the item has not been sent.

(Inherited from ItemType)
IsDraftSpecified

The IsDraftSpecified property gets or sets a Boolean value that specifies whether the IsDraft property is serialized into the SOAP request. This property is required if the IsDraft property is specified.

(Inherited from ItemType)
IsFromMe

The IsFromMe property gets or sets a Boolean value that indicates whether a user sent an item to him or herself.

(Inherited from ItemType)
IsFromMeSpecified

The IsFromMeSpecified property gets or sets a Boolean value that specifies whether the IsFromMe property is serialized into the SOAP request. This property is required if the IsFromMe property is specified.

(Inherited from ItemType)
IsRead

The IsRead property gets a Boolean value that specifies whether the message has been read. This property is read-only.

IsReadReceiptRequested

The IsReadReceiptRequested property gets or sets a Boolean value that specifies whether the sender of a message requests a read receipt. This property is optional. This is a read/write property.

IsReadReceiptRequestedSpecified

The IsReadReceiptRequestedSpecified property gets or sets a Boolean value that specifies whether the IsDeliveryReceiptRequested property is serialized into the Simple Object Access Protocol (SOAP) request. This property is required if the IsReadReceiptRequested property is specified. This is a read/write property.

IsReadSpecified

The IsReadSpecified property gets or sets a Boolean value that specifies whether the IsRead property is serialized into the Simple Object Access Protocol (SOAP) request. This property is required if the IsRead property is specified. This is a read/write property.

IsResend

The IsResend property gets or sets a Boolean value that indicates whether the item has previously been sent.

(Inherited from ItemType)
IsResendSpecified

The IsResendSpecified property gets or sets a Boolean value that specifies whether the IsResend property is serialized into the SOAP request. This property is required if the IsResend property is specified.

(Inherited from ItemType)
IsResponseRequested

The IsResponseRequested property gets or sets a Boolean value that specifies whether a response to an e-mail is requested. This property is optional. This is a read/write property.

IsResponseRequestedSpecified

The IsResponseRequestedSpecified property gets or sets a Boolean value that specifies whether the IsResponseRequested property is serialized into the Simple Object Access Protocol (SOAP) request. This property is required if the IsResponseRequested property is specified. This is a read/write property.

IsSubmitted

The IsSubmitted property gets or sets a Boolean value that indicates whether an item has been submitted to the Outbox default folder.

(Inherited from ItemType)
IsSubmittedSpecified

The IsSubmittedSpecified property gets or sets a Boolean value that specifies whether the IsSubmitted property is serialized into the (SOAP request. This property is required if the IsSubmitted property is specified.

(Inherited from ItemType)
IsUnmodified

The IsUnmodified property returns a Boolean value that indicates whether the item has been modified.

(Inherited from ItemType)
IsUnmodifiedSpecified

The IsUnmodifiedSpecified property gets or sets a Boolean value that specifies whether the IsUnmodified property is serialized into the SOAP request. This property is required if the IsUnmodified property is specified.

(Inherited from ItemType)
ItemClass

The ItemClass property gets or sets a string value that indicates the message class of the item.

(Inherited from ItemType)
ItemId

The ItemId property gets or sets an instance of the ItemIdType class that represents the unique identifier and change key of an item in the Exchange store.

(Inherited from ItemType)
LastModifiedName

The LastModifiedName property gets a string value that contains the name of the user who last modified the item.

(Inherited from ItemType)
LastModifiedTime

The LastModifiedTime property gets an instance of the DateTime structure that represents the date and time that the item was last modified.

(Inherited from ItemType)
LastModifiedTimeSpecified

The LastModifiedTimeSpecified property gets or sets a Boolean value that specifies whether the LastModifiedTime property is serialized into the SOAP request. This property is required if the LastModifiedTime property is specified.

(Inherited from ItemType)
MimeContent

The MimeContent property gets or sets an instance of the MimeContentType class that contains the native MIME stream of an object that is represented in base64Binary format.

(Inherited from ItemType)
NextPredictedAction (Inherited from ItemType)
NextPredictedActionSpecified (Inherited from ItemType)
NormalizedBody (Inherited from ItemType)
ParentFolderId

The ParentFolderId property gets or sets an instance of the FolderIdType class that represents the identifier of the parent folder that contains the item or folder.

(Inherited from ItemType)
PolicyTag (Inherited from ItemType)
Preview (Inherited from ItemType)
ReceivedBy
ReceivedRepresenting
References

The References property gets or sets a string that represents the Usenet header that is used to correlate replies with their original message. This property is optional. This is a read/write property.

ReminderDueBy

The ReminderDueBy property gets or sets an instance of the DateTime structure that represents the date and time when the event occurs. This is used by the ReminderMinutesBeforeStart property to determine when the reminder is displayed.

(Inherited from ItemType)
ReminderDueBySpecified

The ReminderDueBySpecified property gets or sets a Boolean value that specifies whether the ReminderDueBy property is serialized into the SOAP request. This property is required if the ReminderDueBy property is specified.

(Inherited from ItemType)
ReminderIsSet

The ReminderIsSet property gets or sets a Boolean value that indicates whether a reminder has been set for an item in the Exchange store.

(Inherited from ItemType)
ReminderIsSetSpecified

The ReminderIsSetSpecified property gets or sets a Boolean value that specifies whether the ReminderIsSet property is serialized into the SOAP request. This property is required if the ReminderIsSet property is specified.

(Inherited from ItemType)
ReminderMinutesBeforeStart

The ReminderMinutesBeforeStart property gets or sets a string value that indicates the number of minutes before an event occurs when a reminder is displayed.

(Inherited from ItemType)
ReminderNextTime (Inherited from ItemType)
ReminderNextTimeSpecified (Inherited from ItemType)
ReplyTo

The ReplyTo property gets or sets a collection of addresses to which replies should be sent. This property is optional. This is a read/write property.

ResponseObjects

The ResponseObjects property gets or sets an array of the type ResponseObjectType that contains a collection of all the response objects that are associated with an item in the Exchange store.

(Inherited from ItemType)
RetentionDate (Inherited from ItemType)
RetentionDateSpecified (Inherited from ItemType)
RightsManagementLicenseData (Inherited from ItemType)
Sender

The Sender property gets or sets the sender of a message. This property is optional. This is a read/write property.

Sensitivity

The Sensitivity property gets or sets one of the valid SensitivityChoicesType values that indicates the sensitivity level of an item.

(Inherited from ItemType)
SensitivitySpecified

The SensitivitySpecified property gets or sets a Boolean value that specifies whether the Sensitivity property is serialized into the SOAP request. This property is required if the Sensitivity property is specified.

(Inherited from ItemType)
Size

The Size property gets or sets an integer value that represents the size in bytes of an item.

(Inherited from ItemType)
SizeSpecified

The SizeSpecified property gets or sets a Boolean value that specifies whether the Size property is serialized into the SOAP request. This property is required if the Size property is specified.

(Inherited from ItemType)
StoreEntryId (Inherited from ItemType)
Subject

The Subject property gets or sets a string value that represents the subject property of Exchange store items. The subject is limited to 255 characters.

(Inherited from ItemType)
TextBody (Inherited from ItemType)
ToRecipients

The ToRecipients property gets or sets a collection of recipients of an e-mail. This property is required for sending a message. This is a read/write property.

UniqueBody (Inherited from ItemType)
WebClientEditFormQueryString (Inherited from ItemType)
WebClientReadFormQueryString (Inherited from ItemType)

Applies to