我正在尝试通过将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)上创建,而是在主邮箱帐户上创建。
我做错了什么?
答案 0 :(得分:1)
UpdateInboxRules方法对要创建规则的邮箱有一个重载,因此您的方法调用应该是
service.UpdateInboxRules(new RuleOperation[] {createMoveIfFromSalesRule,"TargetMailbxo@domain.com"}, true);