Redigera

Dela via


messageRule resource type

Namespace: microsoft.graph

Important

APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.

Represents a rule that applies to messages in the Inbox of a user.

In Outlook, you can set up rules for incoming messages in the Inbox to carry out specific actions upon certain conditions.

Programmatically, you can access rules through the messageRules navigation property of the Inbox folder. Each rule is represented by this messageRule resource, available rule actions are represented by the messageRuleActions complex type, and available rule conditions and exceptions are represented by the messageRulePredicates complex type.

Methods

Method Return Type Description
List rules messageRule collection Get all the messageRule objects defined for the user's Inbox.
Get rule messageRule Read the properties and relationships of a messageRule object.
Create rule messageRule Create a messageRule object by specifying a set of conditions and actions.
Update rule messageRule Change writable properties on a messageRule object and save the changes.
Delete rule None Delete the specified messageRule object.

Properties

Property Type Description
actions messageRuleActions Actions to be taken on a message when the corresponding conditions are fulfilled.
conditions messageRulePredicates Conditions that when fulfilled trigger the corresponding actions for that rule.
displayName String The display name of the rule.
exceptions messageRulePredicates Exception conditions for the rule.
hasError Boolean Indicates whether the rule is in an error condition. Read-only.
id String The unique identifier of the rule. Read-only.
isEnabled Boolean Indicates whether the rule is enabled to be applied to messages.
isReadOnly Boolean Indicates if the rule is read-only and cannot be modified or deleted by the rules REST API.
sequence Int32 Indicates the order in which the rule is executed, among other rules.

JSON representation

The following JSON representation shows the resource type.

{
  "actions": {"@odata.type": "microsoft.graph.messageRuleActions"},
  "conditions": {"@odata.type": "microsoft.graph.messageRulePredicates"},
  "displayName": "String",
  "exceptions": {"@odata.type": "microsoft.graph.messageRulePredicates"},
  "hasError": "Boolean",
  "id": "String",
  "isEnabled": "Boolean",
  "isReadOnly": "Boolean",
  "sequence": "Int32"
}