protected override IConfigurable PrepareDataObject() { TaskLogger.LogEnter(); ADGroup adgroup = (ADGroup)base.PrepareDataObject(); adgroup.BypassModerationCheck = true; if (this.SmtpAndX500Addresses != null && this.SmtpAndX500Addresses.Count > 0) { adgroup.EmailAddresses = SyncTaskHelper.ReplaceSmtpAndX500Addresses(this.SmtpAndX500Addresses, adgroup.EmailAddresses); } if (base.Fields.IsModified("SipAddresses")) { adgroup.EmailAddresses = SyncTaskHelper.ReplaceSipAddresses(this.SipAddresses, adgroup.EmailAddresses); } if (adgroup.IsModified(MailEnabledRecipientSchema.EmailAddresses)) { adgroup.EmailAddresses = SyncTaskHelper.FilterDuplicateEmailAddresses(base.TenantGlobalCatalogSession, adgroup.EmailAddresses, adgroup, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.TaskWarningLoggingDelegate(this.WriteWarning)); } if (base.Fields.IsModified(ADGroupSchema.GroupType)) { if (this.Type != GroupType.Distribution && this.Type != GroupType.Security) { base.WriteError(new RecipientTaskException(Strings.ErrorGroupTypeInvalid), ExchangeErrorCategory.Client, null); } bool flag = (adgroup.GroupType & GroupTypeFlags.SecurityEnabled) == GroupTypeFlags.SecurityEnabled; if (this.Type == GroupType.Distribution && flag) { adgroup.GroupType &= (GroupTypeFlags)2147483647; if ((adgroup.GroupType & GroupTypeFlags.Universal) == GroupTypeFlags.Universal) { adgroup.RecipientTypeDetails = RecipientTypeDetails.MailUniversalDistributionGroup; } else { adgroup.RecipientTypeDetails = RecipientTypeDetails.MailNonUniversalGroup; } base.DesiredRecipientType = adgroup.RecipientType; if (!adgroup.IsChanged(ADRecipientSchema.RecipientDisplayType)) { adgroup.RecipientDisplayType = new RecipientDisplayType?(RecipientDisplayType.DistributionGroup); } } else if (this.Type == GroupType.Security && !flag) { if (adgroup.RecipientTypeDetails == RecipientTypeDetails.RoomList) { base.WriteError(new TaskInvalidOperationException(Strings.ErrorConvertNonUniversalDistributionGroup(adgroup.Identity.ToString())), ExchangeErrorCategory.Client, adgroup.Identity); } adgroup.GroupType |= GroupTypeFlags.SecurityEnabled; if ((adgroup.GroupType & GroupTypeFlags.Universal) == GroupTypeFlags.Universal) { adgroup.RecipientTypeDetails = RecipientTypeDetails.MailUniversalSecurityGroup; } else { adgroup.RecipientTypeDetails = RecipientTypeDetails.MailNonUniversalGroup; } base.DesiredRecipientType = adgroup.RecipientType; if (!adgroup.IsChanged(ADRecipientSchema.RecipientDisplayType)) { adgroup.RecipientDisplayType = new RecipientDisplayType?(RecipientDisplayType.SecurityDistributionGroup); } } } TaskLogger.LogExit(); return(adgroup); }