internal static void EnabledPrimarySMTPAddressTemplateSetter(object value, IPropertyBag propertyBag) { ProxyAddressTemplateCollection proxyAddressTemplateCollection = (ProxyAddressTemplateCollection)propertyBag[EmailAddressPolicySchema.RawEnabledEmailAddressTemplates]; ProxyAddressTemplate proxyAddressTemplate = null; try { proxyAddressTemplate = ProxyAddressTemplate.Parse((string)value); } catch (ArgumentException ex) { throw new DataValidationException(new PropertyValidationError(new LocalizedString(ex.Message), EmailAddressPolicySchema.EnabledPrimarySMTPAddressTemplate, null), ex); } if (!(proxyAddressTemplate is SmtpProxyAddressTemplate)) { throw new DataValidationException(new PropertyValidationError(DirectoryStrings.ErrorPrimarySmtpTemplateInvalid((string)value), EmailAddressPolicySchema.EnabledPrimarySMTPAddressTemplate, value), null); } ProxyAddressTemplate proxyAddressTemplate2 = proxyAddressTemplateCollection.FindPrimary(ProxyAddressPrefix.Smtp); if (proxyAddressTemplate2 != null && !StringComparer.CurrentCultureIgnoreCase.Equals(proxyAddressTemplate.AddressTemplateString, proxyAddressTemplate2.AddressTemplateString)) { proxyAddressTemplateCollection.Remove(proxyAddressTemplate2); } proxyAddressTemplateCollection.MakePrimary(proxyAddressTemplate); }
internal static object EnabledPrimarySMTPAddressTemplateGetter(IPropertyBag propertyBag) { ProxyAddressTemplateCollection proxyAddressTemplateCollection = (ProxyAddressTemplateCollection)propertyBag[EmailAddressPolicySchema.RawEnabledEmailAddressTemplates]; ProxyAddressTemplate proxyAddressTemplate = proxyAddressTemplateCollection.FindPrimary(ProxyAddressPrefix.Smtp); if (!(null == proxyAddressTemplate)) { return(proxyAddressTemplate.AddressTemplateString); } return(string.Empty); }