Rule 元素Rule element

指定应针对此上下文邮件外接程序计算的激活规则。Specifies the activation rules that should be evaluated for this contextual mail add-in.

外接类型: 邮件 (上下文) Add-in type: Mail (contextual)

包含于Contained in

属性Attributes

属性Attribute 必需Required 说明Description
xsi:typexsi:type Yes 正在定义的规则类型。The type of rule being defined.

此规则类型可以是下列类型之一。The type of rule can be one of the following.

ItemIs 规则ItemIs rule

定义一个在选定项为指定类型时计算结果为 true 的规则。Defines a rule that evaluates to true if the selected item is of the specified type.

属性Attributes

属性Attribute 必需Required 说明Description
ItemTypeItemType Yes 指定要匹配的项目类型。可以是 MessageAppointmentMessage 项目类型包括电子邮件、会议请求、会议响应和会议取消。Specifies the item type to match. Can be Message or Appointment. Message item type includes email, meeting requests, meeting responses, and meeting cancellations.
FormTypeFormType 否(在 ExtensionPoint 内),是(在 OfficeApp 内)No (within ExtensionPoint), Yes (within OfficeApp) 指定应用应出现在项目的读取还是编辑表单中。可以是以下值之一:ReadEditReadOrEdit。如果在 ExtensionPoint 中的 Rule 上指定,则该值必须为 ReadSpecifies whether the app should appear in read or edit form for the item. Can be one of the following: Read, Edit, ReadOrEdit. If specified on a Rule within an ExtensionPoint, this value MUST be Read.
ItemClassItemClass No 指定要匹配的自定义邮件类别。有关详细信息,请参阅在 Outlook 中为特定邮件类别激活邮件外接程序Specifies the custom message class to match. For more information, see Activate a mail add-in in Outlook for a specific message class.
IncludeSubClassesIncludeSubClasses No 指定当项目是指定邮件类别的子类时,该规则的计算结果是否应为 true;默认值为 falseSpecifies whether the rule should evaluate to true if the item is of a subclass of the specified message class; the default is false.

示例Example

<Rule xsi:type="ItemIs" ItemType= "Message" />

ItemHasAttachment 规则ItemHasAttachment rule

定义一个当项目包含附件时计算结果为 true 的规则。Defines a rule that evaluates to true if the item contains an attachment.

示例Example

<Rule xsi:type="ItemHasAttachment" />

ItemHasKnownEntity 规则ItemHasKnownEntity rule

定义一个当项目主题或正文中包含指定实体类型的文本时计算结果为 true 的规则。Defines a rule that evaluates to true if the item contains text of the specified entity type in its subject or body.

属性Attributes

属性Attribute 必需Required 说明Description
EntityTypeEntityType Yes 指定若想规则计算结果为 true 而必须存在的实体类型。可以是以下值之一:MeetingSuggestionTaskSuggestionAddressUrlPhoneNumberEmailAddressContactSpecifies the type of entity that must be found for the rule to evaluate to true. Can be one of the following: MeetingSuggestion, TaskSuggestion, Address, Url, PhoneNumber, EmailAddress, or Contact.
RegExFilterRegExFilter No 指定一个针对此实体运行以进行激活的正则表达式。Specifies a regular expression to run against this entity for activation.
FilterNameFilterName No 指定正则表达式筛选器的名称,以便随后能够在你的外接程序代码中引用该名称。Specifies the name of the regular expression filter, so that it is subsequently possible to refer to it in your add-in's code.
IgnoreCaseIgnoreCase No 指定在匹配由 RegExFilter 属性指定的正则表达式时是否忽略大小写。Specifies whether to ignore case when matching the regular expression specified by the RegExFilter attribute.
HighlightHighlight No 注意: 这仅适用于 ExtensionPoint 元素中的 Rule 元素。指定客户端应如何突出显示匹配的实体。可以是以下值之一:allnone。如果未指定,则默认值为 allNote: this only applies to Rule elements within ExtensionPoint elements. Specifies how the client should highlight matching entities. Can be one of the following: all or none. If not specified, the default value is all.

示例Example

<Rule xsi:type="ItemHasKnownEntity" EntityType="EmailAddress" />

ItemHasRegularExpressionMatch 规则ItemHasRegularExpressionMatch rule

定义一个如果可在项目的指定属性中找到指定的正则表达式的匹配项,则计算结果为 true 的规则。Defines a rule that evaluates to true if a match for the specified regular expression can be found in the specified property of the item.

属性Attributes

属性Attribute 必需Required 说明Description
RegExNameRegExName Yes 指定正则表达式的名称,以便你能够在外接程序的代码中引用该表达式。Specifies the name of the regular expression, so that you can refer to the expression in the code for your add-in.
RegExValueRegExValue Yes 指定将对其求值的正则表达式以确定是否应显示邮件外接程序。Specifies the regular expression that will be evaluated to determine whether the mail add-in should be shown.
PropertyNamePropertyName Yes 指定正则表达式进行计算所依据的属性名称。可以是下列类型之一:SubjectBodyAsPlaintextBodyAsHTMLSenderSMTPAddressSpecifies the name of the property that the regular expression will be evaluated against. Can be one of the following: Subject, BodyAsPlaintext, BodyAsHTML, or SenderSMTPAddress.

如果指定 BodyAsHTML,则 Outlook 只会在项目正文为 HTML 时应用正则表达式。If you specify BodyAsHTML, Outlook only applies the regular expression if the item body is HTML. 否则,Outlook 将不会返回该正则表达式的匹配项。Otherwise, Outlook returns no matches for that regular expression.

如果指定 BodyAsPlaintext,则 Outlook 将始终对项目正文应用正则表达式。If you specify BodyAsPlaintext, Outlook always applies the regular expression on the item body.

注释: 如果指定 Rule 元素的 Highlight 属性,则必须将 PropertyName 属性设为 BodyAsPlaintextNote: You must set the PropertyName attribute to BodyAsPlaintext if you specify the Highlight attribute for the Rule element.
IgnoreCaseIgnoreCase No 指定在匹配由 RegExName 属性指定的正则表达式时是否忽略大小写。Specifies whether to ignore case when matching the regular expression specified by the RegExName attribute.
HighlightHighlight No 指定客户端应如何突出显示匹配的文本。Specifies how the client should highlight matching text. 此属性仅适用于 ExtensionPoint 元素内的 Rule 元素。This attribute can only be applied to Rule elements within ExtensionPoint elements. 可以是以下值之一:allnoneCan be one of the following: all or none. 如果未指定,则默认值为 allIf not specified, the default value is all.

注释: 如果指定 Rule 元素的 Highlight 属性,则必须将 PropertyName 属性设为 BodyAsPlaintextNote: You must set the PropertyName attribute to BodyAsPlaintext if you specify the Highlight attribute for the Rule element.

示例Example

<Rule xsi:type="ItemHasRegularExpressionMatch" RegExName="SupportArticleNumber" RegExValue="(\W|^)kb\d{6}(\W|$)" PropertyName="BodyAsHTML" IgnoreCase="true" />

RuleCollectionRuleCollection

定义一个规则集合以及在计算这些规则时要使用的逻辑运算符。Defines a collection of rules and the logical operator to use when evaluating them.

属性Attributes

属性Attribute 必需Required 说明Description
ModeMode Yes 指定在计算此规则集时要使用的逻辑运算符。可以是以下类型之一:AndOrSpecifies the logical operator to use when evaluating this rule collection. Can be either: And or Or.

示例Example

<Rule xsi:type="RuleCollection" Mode="And">
  <Rule xsi:type="ItemIs" ItemType="Message" />
  <Rule xsi:type="ItemHasKnownEntity" EntityType="MeetingSuggestion" />
  <Rule xsi:type="ItemHasKnownEntity" EntityType="Address" Highlight="none" />
</Rule>

另请参阅See also