public OutlookProtectionRulePresentationObject(TransportRule transportRule) : base(transportRule)
        {
            if (transportRule == null || string.IsNullOrEmpty(transportRule.Xml))
            {
                return;
            }
            OutlookProtectionRule outlookProtectionRule = (OutlookProtectionRule)OutlookProtectionRuleParser.Instance.GetRule(transportRule.Xml);

            this.enabled         = (outlookProtectionRule.Enabled == RuleState.Enabled);
            this.userCanOverride = outlookProtectionRule.UserOverridable;
            PredicateCondition senderDepartmentPredicate = outlookProtectionRule.GetSenderDepartmentPredicate();

            if (senderDepartmentPredicate != null && senderDepartmentPredicate.Value != null)
            {
                this.fromDepartment = new List <string>(senderDepartmentPredicate.Value.RawValues);
            }
            PredicateCondition recipientIsPredicate = outlookProtectionRule.GetRecipientIsPredicate();

            if (recipientIsPredicate != null && recipientIsPredicate.Value != null)
            {
                this.sentTo = new List <SmtpAddress>(from s in recipientIsPredicate.Value.RawValues
                                                     select SmtpAddress.Parse(s));
            }
            PredicateCondition allInternalPredicate = outlookProtectionRule.GetAllInternalPredicate();

            if (allInternalPredicate != null)
            {
                this.sentToScope = ToUserScope.InOrganization;
            }
            RightsProtectMessageAction rightsProtectMessageAction = outlookProtectionRule.GetRightsProtectMessageAction();

            if (rightsProtectMessageAction != null)
            {
                this.applyRightsProtectionTemplate = new RmsTemplateIdentity(new Guid(rightsProtectMessageAction.TemplateId), rightsProtectMessageAction.TemplateName);
            }
        }
 private Microsoft.Exchange.MessagingPolicies.Rules.Action CreateRightsProtectMessageAction()
 {
     return(RightsProtectMessageAction.Create(this.applyRightsProtectionTemplate.TemplateId, this.applyRightsProtectionTemplate.TemplateName));
 }