CreateRuleOperation 类

定义

表示创建收件箱规则的操作。

public ref class CreateRuleOperation sealed : Microsoft::Exchange::WebServices::Data::RuleOperation
public sealed class CreateRuleOperation : Microsoft.Exchange.WebServices.Data.RuleOperation
Public NotInheritable Class CreateRuleOperation
Inherits RuleOperation
继承
CreateRuleOperation

示例

以下示例创建名为“MoveInterestingToJunk”的规则。 规则具有一个 Conditions 属性,该属性指定每当到达主题行中具有字符串“Interesting”的电子邮件时,该邮件将被移动到“垃圾邮件”文件夹。 规则将上传到服务中的服务器。UpdateInboxRules (新的 RuleOperation[] { createOperation }, true) 行。

// Create an Inbox rule.
// If "Interesting" is in the message's subject line, move it into the Junk E-mail folder.
Rule newRule = new Rule();
newRule.DisplayName = "MoveInterestingToJunk";
newRule.Priority = 1;
newRule.IsEnabled = true;
newRule.Conditions.ContainsSubjectStrings.Add("Interesting");
newRule.Actions.MoveToFolder = WellKnownFolderName.JunkEmail;

// Create the CreateRuleOperation.
CreateRuleOperation createRuleOperation = new CreateRuleOperation(newRule);
service.UpdateInboxRules(new RuleOperation[] { createRuleOperation }, true);

注解

收件箱规则是一组 Conditions 关联的 和 Actions ,使客户端能够在邮件传递到文件夹时自动组织邮件、对邮件进行分类和操作。

此类派生自 RuleOperation 类。

创建规则时,该规则存储在 Exchange 服务器上。 邮件到达时,Exchange 服务器会评估邮件,并确定它是否满足任何规则 Conditions。 如果有,则 Exchange 服务器将根据规则 Actions处理邮件。 例如,可以创建一个规则,要求将主题中包含特定字符串的任何传入邮件自动移动到预先确定的文件夹。

构造函数

CreateRuleOperation()

初始化 CreateRuleOperation 类的新实例。

CreateRuleOperation(Rule)

使用指定的规则初始化 CreateRuleOperation 类的新实例。

属性

Rule

获取或设置要创建的规则。

适用于