We know in Exchange Server, We can open EMC set TransportRule , and set Transport Rule Action "ModerateMessageByUserAction" or "ModerateMessageByManagerAction".
I need curstom RoutingAgent class and send Moderate Message. how to do is . thanks all.
use ILSpy tool see ModerateMessageByUserAction source code :
namespace Microsoft.Exchange.MessagingPolicies.Rules.Tasks { [Serializable] public class ModerateMessageByUserAction : TransportRuleAction { private const string InternalActionName = "ModerateMessageByUser"; private const string AddressDelimiter = ";"; private SmtpAddress[] addresses; [LocDescription(Strings.IDs.ToAddressesDescription), LocDisplayName(Strings.IDs.ToAddressesDisplayName), ActionParameterName("ModerateMessageByUser")] public virtual SmtpAddress[] Addresses { get { return this.addresses; } set { this.addresses = value; } } internal override string Description { get { string text = RuleDescription.BuildDescriptionStringFromStringArray(Utils.BuildSmtpAddressStringList(this.Addresses), Strings.RuleDescriptionAndDelimiter); return Strings.RuleDescriptionModerateMessageByUser(text); } } protected override void ValidateRead(List<ValidationError> errors) { if (this.Addresses == null || this.Addresses.Length == 0) { errors.Add(new RulePhrase.RulePhraseValidationError(Strings.ArgumentNotSet, base.Name)); return; } SmtpAddress[] array = this.Addresses; for (int i = 0; i < array.Length; i++) { SmtpAddress smtpAddress = array[i]; if (!smtpAddress.IsValidAddress) { errors.Add(new RulePhrase.RulePhraseValidationError(Strings.InvalidRecipient, base.Name)); return; } } base.ValidateRead(errors); } internal static TransportRuleAction CreateFromInternalAction(Action action) { if (action.get_Name() != "ModerateMessageByUser") { return null; } List<SmtpAddress> list = new List<SmtpAddress>(); string stringValue = TransportRuleAction.GetStringValue(action.get_Arguments().get_Item(0)); string[] array = stringValue.Split(new string[] {";" }, StringSplitOptions.RemoveEmptyEntries); string[] array2 = array; for (int i = 0; i < array2.Length; i++) { string text = array2[i]; SmtpAddress item = new SmtpAddress(text.Trim()); list.Add(item); } if (list.Count == 0) { return null; } return new ModerateMessageByUserAction { Addresses = list.ToArray() }; } internal override Action ToInternalAction() { StringBuilder stringBuilder = new StringBuilder(); SmtpAddress[] array = this.Addresses; for (int i = 0; i < array.Length; i++) { SmtpAddress smtpAddress = array[i]; if (!smtpAddress.IsValidAddress) { throw new ArgumentException(Strings.InvalidRecipient, "Addresses"); } string value = smtpAddress.ToString(); if (string.IsNullOrEmpty(value)) { throw new ArgumentException(Strings.InvalidRecipient, "Addresses"); } if (stringBuilder.Length > 0) { stringBuilder.Append(";"); } stringBuilder.Append(value); } ShortList<Argument> shortList = new ShortList<Argument>(); shortList.Add(new Value(stringBuilder.ToString())); return TransportRuleParser.Instance.CreateAction("ModerateMessageByUser", shortList); } } }
Anything is Possible!