protected override void InternalValidate()
 {
     TaskLogger.LogEnter();
     base.InternalValidate();
     if (this.GenerateExternalDirectoryObjectId && (RecipientTaskHelper.GetAcceptedRecipientTypes() & this.DataObject.RecipientTypeDetails) == RecipientTypeDetails.None)
     {
         base.WriteError(new RecipientTaskException(Strings.ErrorCannotGenerateExternalDirectoryObjectIdOnInternalRecipientType(this.Identity.ToString(), this.DataObject.RecipientTypeDetails.ToString())), ExchangeErrorCategory.Client, this.Identity);
     }
     if (base.Fields.IsModified(DistributionGroupSchema.ManagedBy) && (this.DataObject.ManagedBy == null || this.DataObject.ManagedBy.Count == 0))
     {
         base.WriteError(new RecipientTaskException(Strings.AutoGroupManagedByCannotBeEmpty), ExchangeErrorCategory.Client, null);
     }
     TaskLogger.LogExit();
 }
Пример #2
0
        protected override void InternalValidate()
        {
            bool flag = base.CurrentTaskContext.ExchangeRunspaceConfig != null && base.CurrentTaskContext.ExchangeRunspaceConfig.IsAppPasswordUsed;

            if (base.UserSpecifiedParameters.IsModified(UserSchema.ResetPasswordOnNextLogon) && flag)
            {
                base.WriteError(new RecipientTaskException(Strings.ErrorChangePasswordForAppPasswordAccount), ExchangeErrorCategory.Client, this.Identity);
            }
            base.InternalValidate();
            if (this.GenerateExternalDirectoryObjectId && (RecipientTaskHelper.GetAcceptedRecipientTypes() & this.DataObject.RecipientTypeDetails) == RecipientTypeDetails.None)
            {
                base.WriteError(new RecipientTaskException(Strings.ErrorCannotGenerateExternalDirectoryObjectIdOnInternalRecipientType(this.Identity.ToString(), this.DataObject.RecipientTypeDetails.ToString())), ExchangeErrorCategory.Client, this.Identity);
            }
        }
Пример #3
0
        protected override void InternalValidate()
        {
            base.InternalValidate();
            ADContact dataObject = this.DataObject;

            if (dataObject.RecipientTypeDetails == RecipientTypeDetails.MailForestContact && this.IsObjectStateChanged())
            {
                base.WriteError(new TaskInvalidOperationException(Strings.SetMailForestContactNotAllowed(dataObject.Name)), ExchangeErrorCategory.Client, this.DataObject.Identity);
            }
            if (this.GenerateExternalDirectoryObjectId && (RecipientTaskHelper.GetAcceptedRecipientTypes() & this.DataObject.RecipientTypeDetails) == RecipientTypeDetails.None)
            {
                base.WriteError(new RecipientTaskException(Strings.ErrorCannotGenerateExternalDirectoryObjectIdOnInternalRecipientType(this.Identity.ToString(), this.DataObject.RecipientTypeDetails.ToString())), ExchangeErrorCategory.Client, this.Identity);
            }
        }
Пример #4
0
        protected sealed override IConfigurable PrepareDataObject()
        {
            TaskLogger.LogEnter();
            TDataObject tdataObject = (TDataObject)((object)base.PrepareDataObject());

            if (string.IsNullOrEmpty(tdataObject.Alias))
            {
                using (new CmdletMonitoredScope(base.CurrentTaskContext.UniqueId, "BizLogic", "RecipientTaskHelper.GenerateUniqueAlias", LoggerHelper.CmdletPerfMonitors))
                {
                    tdataObject.Alias = RecipientTaskHelper.GenerateUniqueAlias(base.TenantGlobalCatalogSession, base.CurrentOrganizationId, base.Name, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose));
                }
            }
            if (!this.GetEmailAddressPolicyEnabledDefaultValue(tdataObject))
            {
                tdataObject.EmailAddressPolicyEnabled = false;
            }
            if (string.IsNullOrEmpty(tdataObject.DisplayName))
            {
                tdataObject.DisplayName = tdataObject.Name;
            }
            if (base.IsProvisioningLayerAvailable)
            {
                ProvisioningLayer.UpdateAffectedIConfigurable(this, this.ConvertDataObjectToPresentationObject(tdataObject), false);
            }
            else
            {
                base.WriteError(new InvalidOperationException(Strings.ErrorNoProvisioningHandlerAvailable), (ErrorCategory)1001, null);
            }
            if (tdataObject.EmailAddresses.Count > 0)
            {
                using (new CmdletMonitoredScope(base.CurrentTaskContext.UniqueId, "BizLogic", "NewRecipientObjectTask<TDataObject>.VerifyProxyAddress", LoggerHelper.CmdletPerfMonitors))
                {
                    ADSessionSettings sessionSettings = ADSessionSettings.FromOrganizationIdWithoutRbacScopes(base.RootOrgContainerId, tdataObject.OrganizationId, base.ExecutingUserOrganizationId, false);
                    IRecipientSession tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(base.DomainController, true, ConsistencyMode.PartiallyConsistent, string.IsNullOrEmpty(base.DomainController) ? null : base.NetCredential, sessionSettings, 867, "PrepareDataObject", "f:\\15.00.1497\\sources\\dev\\Configuration\\src\\ObjectModel\\BaseTasks\\NewAdObjectTask.cs");
                    bool flag = base.Fields["SoftDeletedObject"] != null;
                    if (flag)
                    {
                        RecipientTaskHelper.StripInvalidSMTPAddress(this.ConfigurationSession, tdataObject, base.ProvisioningCache, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.ErrorLoggerReThrowDelegate(this.WriteError));
                        RecipientTaskHelper.StripConflictEmailAddress(tenantOrRootOrgRecipientSession, tdataObject, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.ErrorLoggerReThrowDelegate(this.WriteError));
                    }
                    else
                    {
                        if (VariantConfiguration.InvariantNoFlightingSnapshot.Global.MultiTenancy.Enabled && this.ShouldCheckAcceptedDomains())
                        {
                            RecipientTaskHelper.ValidateSmtpAddress(this.ConfigurationSession, tdataObject.EmailAddresses, tdataObject, new Task.ErrorLoggerDelegate(base.WriteError), base.ProvisioningCache);
                        }
                        RecipientTaskHelper.ValidateEmailAddressErrorOut(tenantOrRootOrgRecipientSession, tdataObject.EmailAddresses, tdataObject, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.ErrorLoggerReThrowDelegate(this.WriteError));
                    }
                }
            }
            if (VariantConfiguration.InvariantNoFlightingSnapshot.Global.MultiTenancy.Enabled)
            {
                ADRecipient adrecipient = tdataObject;
                if ((RecipientTaskHelper.GetAcceptedRecipientTypes() & adrecipient.RecipientTypeDetails) != RecipientTypeDetails.None && string.IsNullOrEmpty(adrecipient.ExternalDirectoryObjectId))
                {
                    adrecipient.ExternalDirectoryObjectId = Guid.NewGuid().ToString("D");
                }
            }
            TaskLogger.LogExit();
            return(tdataObject);
        }