使用 EWS Managed API 创建收件箱规则
Create Inbox rules by using the EWS Managed API
我正在尝试通过使用 EWS API 为共享邮箱创建规则。为此,我使用以下代码:
Rule newRule = new Rule();
newRule.DisplayName = "Forward";
forwardEmailTo= "xxx@hotmail.com";
newRule.Conditions.SentToAddresses.Add("Forward", "sharedmailbox@myexchangedomain.online");
newRule.Actions.ForwardToRecipients.Add(forwardEmailTo);
CreateRuleOperation createMoveIfFromSalesRule = new CreateRuleOperation(newRule);
service.UpdateInboxRules(new RuleOperation[] {createMoveIfFromSalesRule}, true);
但不幸的是,规则不是在共享邮箱 (sharedmailbox@myexchangedomain.online) 上创建的,而是在主邮箱帐户上创建的。
我做错了什么?
UpdateInboxRules 方法对您要在其中创建规则的邮箱有重载,因此您的方法调用应该是
service.UpdateInboxRules(new RuleOperation[] {createMoveIfFromSalesRule,"TargetMailbxo@domain.com"}, true);
我正在尝试通过使用 EWS API 为共享邮箱创建规则。为此,我使用以下代码:
Rule newRule = new Rule();
newRule.DisplayName = "Forward";
forwardEmailTo= "xxx@hotmail.com";
newRule.Conditions.SentToAddresses.Add("Forward", "sharedmailbox@myexchangedomain.online");
newRule.Actions.ForwardToRecipients.Add(forwardEmailTo);
CreateRuleOperation createMoveIfFromSalesRule = new CreateRuleOperation(newRule);
service.UpdateInboxRules(new RuleOperation[] {createMoveIfFromSalesRule}, true);
但不幸的是,规则不是在共享邮箱 (sharedmailbox@myexchangedomain.online) 上创建的,而是在主邮箱帐户上创建的。
我做错了什么?
UpdateInboxRules 方法对您要在其中创建规则的邮箱有重载,因此您的方法调用应该是
service.UpdateInboxRules(new RuleOperation[] {createMoveIfFromSalesRule,"TargetMailbxo@domain.com"}, true);