messageRule 资源类型messageRule resource type

适用于用户收件箱邮件的规则。A rule that applies to messages in the Inbox of a user.

在 Outlook 中,可以为收件箱中的传入邮件设置规则,以便在特定条件下执行具体操作。In Outlook, you can set up rules for incoming messages in the Inbox to carry out specific actions upon certain conditions.

可以按编程方式通过收件箱文件夹messageRules 导航属性来访问规则。Programmatically, you can access rules through the messageRules navigation property of the Inbox folder. 每个规则都由此 messageRule 资源表示,可用的规则操作由 messageRuleActions 复杂类型表示,而可用的规则条件和例外则通过 messageRulePredicates 复杂类型表示。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.


属性Property 类型Type 说明Description
actionsactions messageRuleActionsmessageRuleActions 满足相应条件时对邮件执行的操作。Actions to be taken on a message when the corresponding conditions are fulfilled.
conditionsconditions messageRulePredicatesmessageRulePredicates 满足条件时,将触发该规则的相应操作。Conditions that when fulfilled, will trigger the corresponding actions for that rule.
displayNamedisplayName StringString 规则的显示名称。The display name of the rule.
exceptionsexceptions messageRulePredicatesmessageRulePredicates 规则的例外情况。Exception conditions for the rule.
hasErrorhasError BooleanBoolean 指示规则是否处于错误状态。Indicates whether the rule is in an error condition. 只读。Read-only.
idid StringString 规则的唯一标识符。The unique identifier of the rule. 只读。Read-only.
isEnabledisEnabled BooleanBoolean 指示是否启用规则以应用到邮件。Indicates whether the rule is enabled to be applied to messages.
isReadOnlyisReadOnly BooleanBoolean 表示规则是否为只读且无法由规则 REST API 修改或删除。Indicates if the rule is read-only and cannot be modified or deleted by the rules REST API.
Sequencesequence Int32Int32 表示在其他规则中执行规则的顺序。Indicates the order in which the rule is executed, among other rules.

JSON 表示形式JSON representation

下面是资源的 JSON 表示形式。Here is a JSON representation of the resource.

  "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"


方法Method 返回类型Return Type 说明Description
List rulesList rules messageRule 集合messageRule collection 获取为用户收件箱定义的所有 messageRule 对象。Get all the messageRule objects defined for the user's Inbox.
Get ruleGet rule messageRulemessageRule 读取 messageRule 对象的属性和关系。Read the properties and relationships of a messageRule object.
CreateCreate messageRulemessageRule 通过指定一组条件和操作来创建 messageRule 对象。Create a messageRule object by specifying a set of conditions and actions.
UpdateUpdate messageRulemessageRule messageRule 对象更改可写属性并保存更改。Change writable properties on a messageRule object and save the changes.
删除Delete None 删除指定的 messageRule 对象。Delete the specified messageRule object.