message resource type

A message in a mailFolder.

This resource supports:

  • Adding your own data to custom properties using extensions.
  • Using delta query to track incremental additions, deletions, and updates, by providing a delta function.

Methods

Method Return Type Description
List messages message collection Get all the messages in the signed-in user's mailbox (including the Deleted Items and Clutter folders).
Create message message Create a draft of a new message.
Get message message Read properties and relationships of message object.
Update message Update message object.
Delete None Delete message object.
copy Message Copy a message to a folder.
createForward Message Create a draft of the Forward message. You can then update or send the draft.
createReply Message Create a draft of the Reply message. You can then update or send the draft.
createReplyAll Message Create a draft of the Reply All message. You can then update or send the draft.
delta message collection Get a set of messages that have been added, deleted, or updated in a specified folder.
forward None Forward a message. The message is then saved in the Sent Items folder.
move Message Move the message to a folder. This creates a new copy of the message in the destination folder.
reply None Reply to the sender of a message. The message is then saved in the Sent Items folder.
replyAll None Reply to all recipients of a message. The message is then saved in the Sent Items folder.
send None Sends a previously created message draft. The message is then saved in the Sent Items folder.
Attachments
List attachments Attachment collection Gets all attachments on a message.
Add attachment Attachment Add a new attachment to a message by posting to the attachments collection.
Open extensions
Create open extension openTypeExtension Create an open extension and add custom properties in a new or existing instance of a resource.
Get open extension openTypeExtension collection Get an open extension object or objects identified by name or fully qualified name.
Schema extensions
Add schema extension values Create a schema extension definition and then use it to add custom typed data to a resource.
Extended properties
Create single-value extended property message Create one or more single-value extended properties in a new or existing message.
Get message with single-value extended property message Get messages that contain a single-value extended property by using $expand or $filter.
Create multi-value extended property message Create one or more multi-value extended properties in a new or existing message.
Get message with multi-value extended property message Get a message that contains a multi-value extended property by using $expand.

Properties

Property Type Description
bccRecipients recipient collection The Bcc: recipients for the message.
body itemBody The body of the message. It can be in HTML or text format.
bodyPreview String The first 255 characters of the message body. It is in text format.
categories String collection The categories associated with the message.
ccRecipients recipient collection The Cc: recipients for the message.
changeKey String The version of the message.
conversationId String The ID of the conversation the email belongs to.
createdDateTime DateTimeOffset The date and time the message was created.
from recipient The mailbox owner and sender of the message.
hasAttachments Boolean Indicates whether the message has attachments. This property doesn't include inline attachments, so if a message contains only inline attachments, this property is false. To verify the existence of inline attachments, parse the body property to look for a src attribute, such as <IMG src="cid:image001.jpg@01D26CD8.6C05F070">.
id String Unique identifier for the message (note that this value may change if a message is moved or altered)
importance String The importance of the message: Low, Normal, High.
inferenceClassification String The classification of the message for the user, based on inferred relevance or importance, or on an explicit override. Possible values are: focused or other.
internetMessageId String The message ID in the format specified by RFC2822.
isDeliveryReceiptRequested Boolean Indicates whether a read receipt is requested for the message.
isDraft Boolean Indicates whether the message is a draft. A message is a draft if it hasn't been sent yet.
isRead Boolean Indicates whether the message has been read.
isReadReceiptRequested Boolean Indicates whether a read receipt is requested for the message.
lastModifiedDateTime DateTimeOffset The date and time the message was last changed.
parentFolderId String The unique identifier for the message's parent mailFolder.
receivedDateTime DateTimeOffset The date and time the message was received.
replyTo recipient collection The email addresses to use when replying.
sender recipient The account that is actually used to generate the message.
sentDateTime DateTimeOffset The date and time the message was sent.
subject String The subject of the message.
toRecipients recipient collection The To: recipients for the message.
uniqueBody itemBody The part of the body of the message that is unique to the current message. uniqueBody is not returned by default but can be retrieved for a given message by use of the ?$select=uniqueBody query. It can be in HTML or text format.
webLink String The URL to open the message in Outlook Web App.

You can append an ispopout argument to the end of the URL to change how the message is displayed. If ispopout is not present or if it is set to 1, then the message is shown in a popout window. If ispopout is set to 0, then the browser will show the message in the Outlook Web App review pane.

The message will open in the browser if you are logged in to your mailbox via Outlook Web App. You will be prompted to login if you are not already logged in with the browser.

This URL can be accessed from within an iFrame.

Removing script from the body property

The message body can be either HTML or text. If the body is HTML, by default, any potentially unsafe HTML (for example, JavaScript) embedded in the body property would be removed before the body content is returned in a REST response. To get the entire, original HTML content, include the following HTTP request header:

Prefer: outlook.allow-unsafe-html

Setting the from and sender properties

When a message is being composed, in most cases, the From and Sender properties represent the same signed-in user, unless either is updated as described in the following scenarios:

  • The from property can be changed if the Exchange administrator has assigned sendAs rights of the mailbox to some other users. The administrator can do this by selecting Mailbox Permissions of the mailbox owner in the Azure Management Portal, or by using the Exchange Admin Center or a Windows PowerShell Add-ADPermission cmdlet. Then, you can programmatically set the from property to one of these users who have sendAs rights for that mailbox.
  • The sender property can be changed if the mailbox owner has delegated one or more users to be able to send messages from that mailbox. The mailbox owner can delegate in Outlook. When a delegate sends a message on behalf of the mailbox owner, the sender property is set to the delegate’s account, and the from property remains as the mailbox owner. Programmatically, you can set the sender property to a user who has got delegate right for that mailbox.

Relationships

Relationship Type Description
attachments attachment collection The fileAttachment and itemAttachment attachments for the message.
extensions extension collection The collection of open extensions defined for the message. Read-only. Nullable.
multiValueExtendedProperties multiValueLegacyExtendedProperty collection The collection of multi-value extended properties defined for the message. Read-only. Nullable.
singleValueExtendedProperties singleValueLegacyExtendedProperty collection The collection of single-value extended properties defined for the message. Read-only. Nullable.

JSON representation

Here is a JSON representation of the resource

{
  "bccRecipients": [{"@odata.type": "microsoft.graph.recipient"}],
  "body": {"@odata.type": "microsoft.graph.itemBody"},
  "bodyPreview": "string",
  "categories": ["string"],
  "ccRecipients": [{"@odata.type": "microsoft.graph.recipient"}],
  "changeKey": "string",
  "conversationId": "string",
  "createdDateTime": "String (timestamp)",
  "from": {"@odata.type": "microsoft.graph.recipient"},
  "hasAttachments": true,
  "id": "string (identifier)",
  "importance": "String",
  "inferenceClassification": "String",
  "internetMessageId": "String",
  "isDeliveryReceiptRequested": true,
  "isDraft": true,
  "isRead": true,
  "isReadReceiptRequested": true,
  "lastModifiedDateTime": "String (timestamp)",
  "parentFolderId": "string",
  "receivedDateTime": "String (timestamp)",
  "replyTo": [{"@odata.type": "microsoft.graph.recipient"}],
  "sender": {"@odata.type": "microsoft.graph.recipient"},
  "sentDateTime": "String (timestamp)",
  "subject": "string",
  "toRecipients": [{"@odata.type": "microsoft.graph.recipient"}],
  "uniqueBody": {"@odata.type": "microsoft.graph.itemBody"},
  "webLink": "string"
}

See also