protected override void InternalBeginProcessing() { TaskLogger.LogEnter(); if (this.nameWarning != LocalizedString.Empty) { this.WriteWarning(this.nameWarning); } base.InternalBeginProcessing(); if (this.Administrator != null) { OrganizationTaskHelper.ValidateParamString("Administrator", this.Administrator.ToString(), new Task.TaskErrorLoggingDelegate(base.WriteError)); } if (this.AdministratorNetID != null) { OrganizationTaskHelper.ValidateParamString("AdministratorNetID", this.AdministratorNetID.ToString(), new Task.TaskErrorLoggingDelegate(base.WriteError)); } if (this.AdministratorNetID != null && this.Administrator != null && this.Administrator.NetId != null && !this.AdministratorNetID.Equals(this.Administrator.NetId)) { base.WriteError(new RecipientTaskException(Strings.ErrorNetIDValuesDoNotMatch(this.AdministratorNetID.ToString(), this.Administrator.NetId.ToString())), ErrorCategory.InvalidArgument, null); } if (this.AdministratorNetID != null && this.Administrator == null) { this.Administrator = new WindowsLiveId(this.AdministratorNetID.ToString()); } if (base.Fields.IsModified("TenantDirSyncServiceInstance") && !string.IsNullOrEmpty(this.DirSyncServiceInstance) && !ServiceInstanceId.IsValidServiceInstanceId(this.DirSyncServiceInstance)) { base.WriteError(new InvalidServiceInstanceIdException(this.DirSyncServiceInstance), ExchangeErrorCategory.Client, null); } if (this.ServicePlanConfig.IsPilotOffer(this.ProgramId, this.OfferId) && !this.CreateSharedConfiguration) { base.WriteError(new ArgumentException(Strings.ErrorPilotServicePlanCanBeUsedToCreateSharedOrgsOnly(this.ProgramId, this.OfferId)), (ErrorCategory)1000, null); } Exception ex = null; string text = null; if (base.Fields["TenantExternalDirectoryOrganizationId"] == null && !this.CreateSharedConfiguration) { base.Fields["TenantExternalDirectoryOrganizationId"] = Guid.NewGuid(); } try { bool flag = this.ServicePlanConfig.TryGetHydratedOfferId(this.ProgramId, this.OfferId, out text); if (!this.CreateSharedConfiguration && this.Name == null) { base.WriteError(new ArgumentException(Strings.ErrorNameNotSet), (ErrorCategory)1000, null); } this.partition = ((this.AccountPartition != null) ? NewOrganizationTask.ResolvePartitionId(this.AccountPartition, new Task.TaskErrorLoggingDelegate(base.WriteError)) : NewOrganizationTask.ChoosePartition(this.Name, this.CreateSharedConfiguration, new Task.TaskErrorLoggingDelegate(base.WriteError))); if (this.CreateSharedConfiguration && flag) { this.OfferId = text; this.shouldCreateSCT = NewOrganizationTask.ShouldCreateSharedConfiguration(this.ProgramId, this.OfferId, this.partition, out this.sctConfigUnit); } string text2 = this.ServicePlanConfig.ResolveServicePlanName(this.ProgramId, this.OfferId); this.servicePlanSettings = this.ServicePlanConfig.GetServicePlanSettings(text2); bool flag2 = this.ServicePlanConfig.IsTemplateTenantServicePlan(this.servicePlanSettings); if (flag2) { this.shouldCreateSCT = NewOrganizationTask.ShouldCreateTenantTemplate(this.ProgramId, this.OfferId, this.partition, out this.sctConfigUnit); } if (this.CreateSharedConfiguration) { if (!this.shouldCreateSCT) { this.WriteWarning(Strings.WarningSharedConfigurationAlreadyExists(this.ProgramId, this.OfferId)); return; } if (string.IsNullOrEmpty(this.Name)) { this.Name = (flag2 ? TemplateTenantConfiguration.CreateSharedConfigurationName(this.ProgramId, this.OfferId) : SharedConfiguration.CreateSharedConfigurationName(this.ProgramId, this.OfferId)); } if (this.DomainName == null) { this.DomainName = (flag2 ? TemplateTenantConfiguration.CreateSharedConfigurationDomainName(this.Name) : SharedConfiguration.CreateSharedConfigurationDomainName(this.Name)); } } OrganizationTaskHelper.ValidateParamString("Name", this.Name, new Task.TaskErrorLoggingDelegate(base.WriteError), true); ADOrganizationalUnit adorganizationalUnit = new ADOrganizationalUnit(); adorganizationalUnit[ADObjectSchema.Name] = this.Name; base.InternalIsSharedConfigServicePlan = this.ServicePlanConfig.IsSharedConfigurationAllowedForServicePlan(this.servicePlanSettings); if (this.CreateSharedConfiguration && !base.InternalIsSharedConfigServicePlan && !this.ServicePlanConfig.IsHydratedOffer(text2)) { base.WriteError(new SharedConfigurationValidationException(Strings.ErrorServicePlanDoesntAllowSharedConfiguration(this.ProgramId, this.OfferId)), (ErrorCategory)1000, null); } else if (!flag && base.InternalIsSharedConfigServicePlan) { text = this.OfferId; } if (this.CreateSharedConfiguration) { base.InternalCreateSharedConfiguration = true; } else if (!this.CreateSharedConfiguration && base.InternalIsSharedConfigServicePlan) { SharedConfigurationInfo sharedConfigurationInfo = SharedConfigurationInfo.FromInstalledVersion(this.ProgramId, text); base.InternalSharedConfigurationId = SharedConfiguration.FindOneSharedConfigurationId(sharedConfigurationInfo, this.partition); if (base.InternalSharedConfigurationId == null) { base.WriteError(new SharedConfigurationValidationException(Strings.ErrorSharedConfigurationNotFound(this.ProgramId, text, sharedConfigurationInfo.CurrentVersion.ToString())), (ErrorCategory)1000, null); } base.InternalCreateSharedConfiguration = false; } List <ValidationError> list = new List <ValidationError>(); list.AddRange(ServicePlan.ValidateFileSchema(text2)); list.AddRange(this.servicePlanSettings.Validate()); if (list.Count != 0) { ex = new ArgumentException(Strings.ErrorServicePlanInconsistent(text2, this.ProgramId, this.OfferId, ValidationError.CombineErrorDescriptions(list))); } } catch (ArgumentException ex2) { ex = ex2; } catch (IOException ex3) { ex = ex3; } if (ex != null) { base.WriteError(ex, ErrorCategory.InvalidArgument, null); } base.InternalLocalStaticConfigEnabled = (!this.servicePlanSettings.Organization.AdvancedHydrateableObjectsSharedEnabled || this.CreateSharedConfiguration); base.InternalLocalHydrateableConfigEnabled = (!this.servicePlanSettings.Organization.CommonHydrateableObjectsSharedEnabled || this.CreateSharedConfiguration); TaskLogger.LogExit(); }