public static List <string> GetEtrsForDlpPolicy(Guid dlpGuid, IConfigDataProvider dataSession) { ADRuleStorageManager adruleStorageManager; IEnumerable <TransportRuleHandle> transportRuleHandles = DlpUtils.GetTransportRuleHandles(dataSession, out adruleStorageManager); IEnumerable <Microsoft.Exchange.MessagingPolicies.Rules.Tasks.Rule> source = from ruleHandle in transportRuleHandles select Microsoft.Exchange.MessagingPolicies.Rules.Tasks.Rule.CreateFromInternalRule(TransportRulePredicate.GetAvailablePredicateMappings(), TransportRuleAction.GetAvailableActionMappings(), ruleHandle.Rule, ruleHandle.AdRule.Priority, ruleHandle.AdRule); return((from rule in source where rule.DlpPolicyId == dlpGuid select rule.ToCmdlet()).ToList <string>()); }
internal static IEnumerable <Microsoft.Exchange.MessagingPolicies.Rules.Tasks.Rule> GetTransportRules(IConfigDataProvider dataSession, Func <Microsoft.Exchange.MessagingPolicies.Rules.Tasks.Rule, bool> selector) { ADRuleStorageManager adruleStorageManager; IEnumerable <TransportRuleHandle> transportRuleHandles = DlpUtils.GetTransportRuleHandles(dataSession, out adruleStorageManager); IEnumerable <Microsoft.Exchange.MessagingPolicies.Rules.Tasks.Rule> source = from ruleHandle in transportRuleHandles select Microsoft.Exchange.MessagingPolicies.Rules.Tasks.Rule.CreateFromInternalRule(TransportRulePredicate.GetAvailablePredicateMappings(), TransportRuleAction.GetAvailableActionMappings(), ruleHandle.Rule, ruleHandle.AdRule.Priority, ruleHandle.AdRule); return(source.Where(selector)); }