private bool IsNameUnique(string name) { ADScope scope = null; if (base.CurrentOrganizationId.OrganizationalUnit != null) { scope = new ADScope(base.CurrentOrganizationId.OrganizationalUnit, new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.OrganizationalUnitRoot, base.CurrentOrganizationId.OrganizationalUnit)); } return(RecipientTaskHelper.IsPropertyValueUnique(base.TenantGlobalCatalogSession, scope, null, new ADPropertyDefinition[] { ADObjectSchema.Name }, ADObjectSchema.Name, name, false, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), null, ExchangeErrorCategory.Client, false)); }
protected override void InternalValidate() { base.InternalValidate(); if (base.Fields.IsModified(ADMailboxRecipientSchema.SharePointUrl)) { Uri sharePointUrl = this.SharePointUrl; if (sharePointUrl != null && (!sharePointUrl.IsAbsoluteUri || (!(sharePointUrl.Scheme == Uri.UriSchemeHttps) && !(sharePointUrl.Scheme == Uri.UriSchemeHttp)))) { base.WriteError(new RecipientTaskException(Strings.ErrorTeamMailboxSharePointUrl), ExchangeErrorCategory.Client, null); } } if (base.Fields.IsChanged(ADMailboxRecipientSchema.DelegateListLink) && this.DataObject.ModernGroupType != ModernGroupObjectType.Public) { base.WriteError(new GroupMailboxInvalidOperationException(Strings.ErrorInvalidGroupTypeForPublicToGroups), ExchangeErrorCategory.Client, null); } if (base.Fields.IsChanged(ADUserSchema.Owners) && this.Owners != null && this.Owners.Length == 0) { base.WriteError(new GroupMailboxInvalidOperationException(Strings.ErrorSetGroupMailboxNoOwners), ExchangeErrorCategory.Client, null); } if (base.Fields.IsChanged("YammerGroupEmailAddress") && !string.IsNullOrEmpty(this.YammerGroupEmailAddress) && !ProxyAddressBase.IsAddressStringValid(this.YammerGroupEmailAddress)) { base.WriteError(new GroupMailboxInvalidOperationException(Strings.ErrorSetGroupMailboxInvalidYammerEmailAddress(this.YammerGroupEmailAddress)), ExchangeErrorCategory.Client, null); } if (base.Fields.IsChanged(GroupMailboxSchema.EmailAddresses) && base.Fields.IsChanged(GroupMailboxSchema.PrimarySmtpAddress)) { base.ThrowTerminatingError(new RecipientTaskException(Strings.ErrorPrimarySmtpAndEmailAddressesSpecified), ExchangeErrorCategory.Client, null); } if (base.Fields.IsChanged(ADRecipientSchema.ExternalDirectoryObjectId) && !string.IsNullOrEmpty(this.ExternalDirectoryObjectId) && !RecipientTaskHelper.IsPropertyValueUnique(base.TenantGlobalCatalogSession, ADScope.Empty, null, new ADPropertyDefinition[] { ADRecipientSchema.ExternalDirectoryObjectId }, ADRecipientSchema.ExternalDirectoryObjectId, this.ExternalDirectoryObjectId, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), null, ExchangeErrorCategory.Client)) { base.ThrowTerminatingError(new RecipientTaskException(Strings.ErrorExternalDirectoryObjectIdNotUnique(this.ExternalDirectoryObjectId)), ExchangeErrorCategory.Client, null); } }