protected override IConfigurable ConvertDataObjectToPresentationObject(IConfigurable dataObject) { if (dataObject == null) { return(null); } return(RecipientTaskHelper.ConvertRecipientToPresentationObject((ADRecipient)dataObject)); }
protected override void PrepareRecipientObject(ADPublicFolder publicFolder) { this.DataObject = publicFolder; if (MapiTaskHelper.IsDatacenter) { publicFolder.OrganizationId = base.CurrentOrganizationId; } publicFolder.StampPersistableDefaultValues(); if (this.Name.Contains("\n")) { this.Name = this.Name.Replace("\n", "_"); } if (this.Name.Length > 64) { publicFolder.Name = this.Name.Substring(0, 64); } else { publicFolder.Name = this.Name; } publicFolder.DisplayName = publicFolder.Name; publicFolder.Alias = RecipientTaskHelper.GenerateUniqueAlias(this.RecipientSession, OrganizationId.ForestWideOrgId, this.Alias, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose)); if (this.WindowsEmailAddress != SmtpAddress.Empty) { publicFolder.WindowsEmailAddress = this.WindowsEmailAddress; } else { publicFolder.WindowsEmailAddress = publicFolder.PrimarySmtpAddress; } publicFolder.HiddenFromAddressListsEnabled = this.HiddenFromAddressListsEnabled; publicFolder.SendModerationNotifications = TransportModerationNotificationFlags.Never; publicFolder.RecipientTypeDetails = RecipientTypeDetails.PublicFolder; publicFolder.ObjectCategory = this.ConfigurationSession.SchemaNamingContext.GetChildId(publicFolder.ObjectCategoryCN); publicFolder.LegacyExchangeDN = PublicFolderSession.ConvertToLegacyDN("e71f13d1-0178-42a7-8c47-24206de84a77", this.EntryId); ADObjectId adobjectId; if (base.CurrentOrganizationId == OrganizationId.ForestWideOrgId) { adobjectId = base.CurrentOrgContainerId.DomainId.GetChildId("Microsoft Exchange System Objects"); } else { adobjectId = base.CurrentOrganizationId.OrganizationalUnit; } ADObjectId childId = adobjectId.GetChildId(publicFolder.Name); ADRecipient adrecipient = this.RecipientSession.Read(childId); if (adrecipient != null) { Random random = new Random(); childId = adobjectId.GetChildId(string.Format("{0} {1}", publicFolder.Name, random.Next(100000000).ToString("00000000"))); } publicFolder.SetId(childId); if (base.IsProvisioningLayerAvailable) { base.WriteVerbose(Strings.VerboseInvokingRUS(publicFolder.Identity.ToString(), publicFolder.GetType().Name)); ADPublicFolder adpublicFolder = new ADPublicFolder(); adpublicFolder.CopyChangesFrom(publicFolder); ProvisioningLayer.UpdateAffectedIConfigurable(this, RecipientTaskHelper.ConvertRecipientToPresentationObject(adpublicFolder), false); publicFolder.CopyChangesFrom(adpublicFolder); } else { base.WriteError(new InvalidOperationException(Strings.ErrorNoProvisioningHandlerAvailable), ErrorCategory.InvalidOperation, null); } if (this.ExternalEmailAddress != SmtpAddress.Empty) { publicFolder.ExternalEmailAddress = ProxyAddress.Parse(this.ExternalEmailAddress.ToString()); } else { publicFolder.ExternalEmailAddress = ProxyAddress.Parse(publicFolder.WindowsEmailAddress.ToString()); } MailUserTaskHelper.ValidateExternalEmailAddress(publicFolder, this.ConfigurationSession, new Task.ErrorLoggerDelegate(base.WriteError), base.ProvisioningCache); if (this.EmailAddresses != null) { foreach (ProxyAddress proxyAddress in this.EmailAddresses) { if (proxyAddress != null && !publicFolder.EmailAddresses.Contains(proxyAddress)) { publicFolder.EmailAddresses.Add(proxyAddress); } } } adrecipient = this.RecipientSession.FindByProxyAddress(ProxyAddress.Parse("X500:" + publicFolder.LegacyExchangeDN)); if (adrecipient != null) { base.WriteError(new InvalidOperationException(Strings.ErrorObjectAlreadyExists("ADPublicFolder object : ", this.Name)), ErrorCategory.InvalidData, null); } publicFolder.EmailAddresses.Add(ProxyAddress.Parse("X500:" + publicFolder.LegacyExchangeDN)); RecipientTaskHelper.ValidateEmailAddressErrorOut(this.RecipientSession, publicFolder.EmailAddresses, publicFolder, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.ErrorLoggerReThrowDelegate(this.WriteError)); }
protected override IConfigurable PrepareDataObject() { TaskLogger.LogEnter(); Organization organization = (Organization)base.PrepareDataObject(); this.isMicrosoftExchangeRecipientChanged = (organization.IsChanged(OrganizationSchema.MicrosoftExchangeRecipientEmailAddresses) || organization.IsChanged(OrganizationSchema.MicrosoftExchangeRecipientEmailAddressPolicyEnabled) || organization.IsChanged(OrganizationSchema.MicrosoftExchangeRecipientPrimarySmtpAddress) || organization.IsChanged(OrganizationSchema.MicrosoftExchangeRecipientReplyRecipient)); if (this.isMicrosoftExchangeRecipientChanged && this.microsoftExchangeRecipient == null) { this.WriteWarning(Strings.ErrorMicrosoftExchangeRecipientNotFound); } if (this.microsoftExchangeRecipient != null) { this.microsoftExchangeRecipient.DisplayName = ADMicrosoftExchangeRecipient.DefaultDisplayName; this.microsoftExchangeRecipient.DeliverToMailboxAndForward = false; if (organization.IsChanged(OrganizationSchema.MicrosoftExchangeRecipientEmailAddresses)) { this.microsoftExchangeRecipient.EmailAddresses.CopyChangesFrom(organization.MicrosoftExchangeRecipientEmailAddresses); if (Datacenter.IsMultiTenancyEnabled()) { RecipientTaskHelper.ValidateSmtpAddress(this.ConfigurationSession, this.microsoftExchangeRecipient.EmailAddresses, this.microsoftExchangeRecipient, new Task.ErrorLoggerDelegate(base.WriteError), base.ProvisioningCache); } ADSessionSettings sessionSettings = ADSessionSettings.FromOrganizationIdWithoutRbacScopes(base.RootOrgContainerId, this.microsoftExchangeRecipient.OrganizationId, base.CurrentOrganizationId, false); IRecipientSession tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(base.TenantGlobalCatalogSession.DomainController, true, ConsistencyMode.PartiallyConsistent, base.TenantGlobalCatalogSession.NetworkCredential, sessionSettings, 632, "PrepareDataObject", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\SystemConfigurationTasks\\organization\\SetOrganization.cs"); RecipientTaskHelper.ValidateEmailAddressErrorOut(tenantOrRootOrgRecipientSession, this.microsoftExchangeRecipient.EmailAddresses, this.microsoftExchangeRecipient, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.ErrorLoggerReThrowDelegate(this.WriteError)); if (this.microsoftExchangeRecipient.EmailAddresses.Count > 0) { RecipientTaskHelper.ValidateEmailAddress(base.TenantGlobalCatalogSession, this.microsoftExchangeRecipient.EmailAddresses, this.microsoftExchangeRecipient, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose)); } } if (organization.IsChanged(OrganizationSchema.MicrosoftExchangeRecipientPrimarySmtpAddress)) { this.microsoftExchangeRecipient.PrimarySmtpAddress = organization.MicrosoftExchangeRecipientPrimarySmtpAddress; } if (organization.IsChanged(OrganizationSchema.MicrosoftExchangeRecipientReplyRecipient)) { this.microsoftExchangeRecipient.ForwardingAddress = organization.MicrosoftExchangeRecipientReplyRecipient; } if (organization.IsChanged(OrganizationSchema.MicrosoftExchangeRecipientEmailAddressPolicyEnabled)) { this.microsoftExchangeRecipient.EmailAddressPolicyEnabled = organization.MicrosoftExchangeRecipientEmailAddressPolicyEnabled; } ValidationError[] array = this.microsoftExchangeRecipient.Validate(); for (int i = 0; i < array.Length; i++) { this.WriteError(new DataValidationException(array[i]), ErrorCategory.InvalidData, null, i == array.Length - 1); } if (!ProvisioningLayer.Disabled) { if (base.IsProvisioningLayerAvailable) { ProvisioningLayer.UpdateAffectedIConfigurable(this, RecipientTaskHelper.ConvertRecipientToPresentationObject(this.microsoftExchangeRecipient), false); } else { base.WriteError(new InvalidOperationException(Strings.ErrorNoProvisioningHandlerAvailable), ErrorCategory.InvalidOperation, null); } } organization.MicrosoftExchangeRecipientEmailAddresses = this.microsoftExchangeRecipient.EmailAddresses; organization.MicrosoftExchangeRecipientPrimarySmtpAddress = this.microsoftExchangeRecipient.PrimarySmtpAddress; organization.MicrosoftExchangeRecipientEmailAddressPolicyEnabled = this.microsoftExchangeRecipient.EmailAddressPolicyEnabled; } if (organization.IsChanged(OrganizationSchema.AdfsAuthenticationRawConfiguration) && AdfsAuthenticationConfig.Validate((string)organization[OrganizationSchema.AdfsAuthenticationRawConfiguration])) { this.WriteWarning(Strings.NeedIisRestartWarning); } TaskLogger.LogExit(); return(organization); }
private ADPublicFolder CreatePublicFolderProxy() { ADPublicFolder adpublicFolder = new ADPublicFolder(); if (MapiTaskHelper.IsDatacenter) { adpublicFolder.OrganizationId = base.CurrentOrganizationId; } adpublicFolder.StampPersistableDefaultValues(); string text = this.currentPublicFolder.Name.Trim(); if (text.Length > 256) { adpublicFolder.DisplayName = text.Substring(0, 256); } else { adpublicFolder.DisplayName = text.Trim(); } if (text.Length > 64) { adpublicFolder.Name = text.Substring(0, 64); } else { adpublicFolder.Name = text; } adpublicFolder.Alias = RecipientTaskHelper.GenerateUniqueAlias(this.RecipientSession, OrganizationId.ForestWideOrgId, adpublicFolder.Name, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose)); adpublicFolder.WindowsEmailAddress = adpublicFolder.PrimarySmtpAddress; adpublicFolder.SendModerationNotifications = TransportModerationNotificationFlags.Never; adpublicFolder.RecipientTypeDetails = RecipientTypeDetails.PublicFolder; adpublicFolder.ObjectCategory = this.ConfigurationSession.SchemaNamingContext.GetChildId(adpublicFolder.ObjectCategoryCN); ADRecipient adrecipient = this.RecipientSession.FindByExchangeGuid(this.currentPublicFolder.ContentMailboxGuid); if (adrecipient == null || adrecipient.RecipientTypeDetails != RecipientTypeDetails.PublicFolderMailbox) { base.WriteError(new InvalidOperationException(Strings.ErrorUnableToDetermineContentMailbox(this.Identity.ToString(), this.currentPublicFolder.ContentMailboxGuid)), ErrorCategory.InvalidData, this.Identity); } adpublicFolder.ContentMailbox = adrecipient.Id; adpublicFolder.EntryId = this.currentPublicFolder.EntryId; adpublicFolder.LegacyExchangeDN = PublicFolderSession.ConvertToLegacyDN(this.currentPublicFolder.ContentMailboxGuid.ToString(), this.currentPublicFolder.EntryId); ADObjectId adobjectId; if (!MapiTaskHelper.IsDatacenter) { adobjectId = base.CurrentOrgContainerId.DomainId.GetChildId("Microsoft Exchange System Objects"); } else { adobjectId = base.CurrentOrganizationId.OrganizationalUnit; } ADObjectId childId = adobjectId.GetChildId(adpublicFolder.Name); ADRecipient adrecipient2 = this.RecipientSession.Read(childId); if (adrecipient2 != null) { string text2 = adpublicFolder.Name; if (text2.Length > 55) { text2 = text2.Substring(0, 55); } Random random = new Random(); childId = adobjectId.GetChildId(string.Format("{0} {1}", text2, random.Next(100000000).ToString("00000000"))); } adpublicFolder.SetId(childId); if (base.IsProvisioningLayerAvailable) { base.WriteVerbose(Strings.VerboseInvokingRUS(adpublicFolder.Identity.ToString(), adpublicFolder.GetType().Name)); ADPublicFolder adpublicFolder2 = new ADPublicFolder(); adpublicFolder2.CopyChangesFrom(adpublicFolder); ProvisioningLayer.UpdateAffectedIConfigurable(this, RecipientTaskHelper.ConvertRecipientToPresentationObject(adpublicFolder2), false); adpublicFolder.CopyChangesFrom(adpublicFolder2); } else { base.WriteError(new InvalidOperationException(Strings.ErrorNoProvisioningHandlerAvailable), ErrorCategory.InvalidOperation, null); } return(adpublicFolder); }
internal static void ConnectMailboxCore(ADUser userToConnect, Guid deletedMailboxGuid, StoreMailboxType mailboxType, string deletedMailboxLegacyDN, string parameterSetName, bool clearPropertiesBeforeConnecting, IRecipientSession recipientSession, MapiAdministrationSession mapiAdministrationSession, string alias, SecurityIdentifier linkedUserSid, DatabaseLocationInfo databaseLocationInfo, MailboxDatabase database, ADObjectId elcPolicyId, ADObjectId retentionPolicyId, ADObjectId mobilePolicyId, ADObjectId addressBookPolicyId, Task.TaskVerboseLoggingDelegate verboseLogger, Task.TaskWarningLoggingDelegate warningLogger, ADObjectId roleAssignmentPolicyId, Task task) { if (userToConnect.ExchangeVersion.IsOlderThan(ExchangeObjectVersion.Exchange2012)) { verboseLogger(Strings.VerboseUpdatingVersion(userToConnect.Identity.ToString(), userToConnect.ExchangeVersion.ToString(), ExchangeObjectVersion.Exchange2012.ToString())); userToConnect.SetExchangeVersion(ExchangeObjectVersion.Exchange2012); recipientSession.Save(userToConnect); verboseLogger(Strings.VerboseADOperationSucceeded(userToConnect.Identity.ToString())); bool useGlobalCatalog = recipientSession.UseGlobalCatalog; try { recipientSession.UseGlobalCatalog = false; userToConnect = (ADUser)recipientSession.Read(userToConnect.Id); } finally { recipientSession.UseGlobalCatalog = useGlobalCatalog; } } if (clearPropertiesBeforeConnecting) { List <PropertyDefinition> list = new List <PropertyDefinition>(RecipientConstants.DisableMailbox_PropertiesToReset); MailboxTaskHelper.RemovePersistentProperties(list); list.Remove(ADObjectSchema.ExchangeVersion); MailboxTaskHelper.ClearExchangeProperties(userToConnect, list); } userToConnect.Alias = alias; if ("Linked" == parameterSetName) { userToConnect.MasterAccountSid = linkedUserSid; } else if ("Shared" == parameterSetName) { userToConnect.MasterAccountSid = new SecurityIdentifier(WellKnownSidType.SelfSid, null); } else if ("Room" == parameterSetName) { userToConnect.ResourceType = new ExchangeResourceType?(ExchangeResourceType.Room); userToConnect.MasterAccountSid = new SecurityIdentifier(WellKnownSidType.SelfSid, null); } else if ("Equipment" == parameterSetName) { userToConnect.ResourceType = new ExchangeResourceType?(ExchangeResourceType.Equipment); userToConnect.MasterAccountSid = new SecurityIdentifier(WellKnownSidType.SelfSid, null); } userToConnect.ServerLegacyDN = databaseLocationInfo.ServerLegacyDN; userToConnect.ExchangeGuid = deletedMailboxGuid; userToConnect.Database = (ADObjectId)database.Identity; userToConnect.LegacyExchangeDN = deletedMailboxLegacyDN.ToLowerInvariant(); userToConnect.ManagedFolderMailboxPolicy = elcPolicyId; userToConnect.RetentionPolicy = retentionPolicyId; userToConnect.ActiveSyncMailboxPolicy = mobilePolicyId; userToConnect.UseDatabaseQuotaDefaults = new bool?(true); userToConnect.AddressBookPolicy = addressBookPolicyId; if (roleAssignmentPolicyId != null) { userToConnect.RoleAssignmentPolicy = roleAssignmentPolicyId; } if (mailboxType == StoreMailboxType.PublicFolderPrimary || mailboxType == StoreMailboxType.PublicFolderSecondary) { userToConnect.MasterAccountSid = new SecurityIdentifier(WellKnownSidType.SelfSid, null); userToConnect.UserAccountControl = (UserAccountControlFlags.AccountDisabled | UserAccountControlFlags.NormalAccount); userToConnect.ExchangeUserAccountControl |= UserAccountControlFlags.AccountDisabled; MailboxTaskHelper.StampMailboxRecipientTypes(userToConnect, "PublicFolder"); } else { MailboxTaskHelper.StampMailboxRecipientTypes(userToConnect, parameterSetName); } if (MailboxTaskHelper.SupportsMailboxReleaseVersioning(userToConnect)) { userToConnect.MailboxRelease = databaseLocationInfo.MailboxRelease; } userToConnect.EmailAddressPolicyEnabled = true; ProvisioningLayer.UpdateAffectedIConfigurable(task, RecipientTaskHelper.ConvertRecipientToPresentationObject(userToConnect), false); recipientSession.Save(userToConnect); verboseLogger(Strings.VerboseADOperationSucceeded(userToConnect.Identity.ToString())); ConnectMailbox.UpdateSDAndRefreshMailbox(mapiAdministrationSession, userToConnect, database, deletedMailboxGuid, parameterSetName, verboseLogger, warningLogger); }
protected override IConfigurable PrepareDataObject() { TaskLogger.LogEnter(); ADRecipient adrecipient = (ADRecipient)base.PrepareDataObject(); if (base.IsProvisioningLayerAvailable) { Fqdn value = (Fqdn)base.UserSpecifiedParameters["DomainController"]; try { base.UserSpecifiedParameters["DomainController"] = this.globalCatalog; ProvisioningLayer.UpdateAffectedIConfigurable(this, RecipientTaskHelper.ConvertRecipientToPresentationObject(adrecipient), false); goto IL_82; } finally { base.UserSpecifiedParameters["DomainController"] = value; } } base.WriteError(new InvalidOperationException(Strings.ErrorNoProvisioningHandlerAvailable), (ErrorCategory)1012, null); IL_82: if (RecipientType.UserMailbox == adrecipient.RecipientType) { ADUser aduser = (ADUser)adrecipient; if (string.IsNullOrEmpty(aduser.ServerLegacyDN)) { base.WriteError(new InvalidOperationException(Strings.ErrorInvalidObjectMissingCriticalProperty(typeof(Mailbox).Name, adrecipient.Identity.ToString(), MailEnabledRecipientSchema.LegacyExchangeDN.Name)), (ErrorCategory)1009, this.Identity); } Server server = this.configurationSession.FindServerByLegacyDN(aduser.ServerLegacyDN); if (server != null) { if (!server.IsExchange2007OrLater) { base.WriteError(new InvalidOperationException(Strings.ErrorCannotUpdateLegacyMailbox(this.Identity.ToString())), (ErrorCategory)1010, this.Identity); } else if (RecipientTaskHelper.IsE15OrLater(server.VersionNumber)) { if (adrecipient.ExchangeVersion.IsOlderThan(ExchangeObjectVersion.Exchange2012)) { adrecipient.SetExchangeVersion(ExchangeObjectVersion.Exchange2012); } } else if (server.IsE14OrLater) { if (adrecipient.ExchangeVersion.IsOlderThan(ExchangeObjectVersion.Exchange2010)) { adrecipient.SetExchangeVersion(ExchangeObjectVersion.Exchange2010); } } else if (adrecipient.ExchangeVersion.IsOlderThan(ExchangeObjectVersion.Exchange2007)) { adrecipient.SetExchangeVersion(ExchangeObjectVersion.Exchange2007); } } SetMailboxBase <MailboxIdParameter, Mailbox> .StampMailboxTypeDetails(adrecipient, true); MailboxTaskHelper.StampMailboxRecipientDisplayType(adrecipient); if (server != null && server.IsE14OrLater) { NetID netID = aduser.NetID; if (netID != null) { aduser.NetID = netID; } } if (aduser.RoleAssignmentPolicy == null && RecipientTypeDetails.None == (aduser.RecipientTypeDetails & (RecipientTypeDetails.PublicFolder | RecipientTypeDetails.SystemMailbox | RecipientTypeDetails.ArbitrationMailbox | RecipientTypeDetails.DiscoveryMailbox | RecipientTypeDetails.AuditLogMailbox))) { RoleAssignmentPolicy roleAssignmentPolicy = RecipientTaskHelper.FindDefaultRoleAssignmentPolicy(RecipientTaskHelper.GetTenantLocalConfigSession(base.CurrentOrganizationId, base.ExecutingUserOrganizationId, base.RootOrgContainerId), new Task.ErrorLoggerDelegate(base.WriteError), Strings.ErrorDefaultRoleAssignmentPolicyNotUnique, Strings.ErrorDefaultRoleAssignmentPolicyNotFound); if (roleAssignmentPolicy != null) { aduser.RoleAssignmentPolicy = (ADObjectId)roleAssignmentPolicy.Identity; } } } TaskLogger.LogExit(); return(adrecipient); }
private static void UpdateRecipients(EmailAddressPolicy eap, OrganizationId organizationId, string domainController, IRecipientSession globalCatalogSession, Task.TaskVerboseLoggingDelegate writeVerbose, Task.TaskWarningLoggingDelegate writeWarning, WriteProgress writeProgress, Task cmdlet, bool fixMissingAlias) { UpdateEmailAddressPolicy.AssertArgumentNotNull(eap, "eap"); UpdateEmailAddressPolicy.AssertArgumentNotNull(writeVerbose, "writeVerbose"); UpdateEmailAddressPolicy.AssertArgumentNotNull(writeWarning, "writeWarning"); UpdateEmailAddressPolicy.AssertArgumentNotNull(writeProgress, "writeProgress"); if (string.IsNullOrEmpty(eap.LdapRecipientFilter) && !fixMissingAlias) { return; } int num = 0; try { if (cmdlet != null && cmdlet.Stopping) { return; } IRecipientSession tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(false, ConsistencyMode.PartiallyConsistent, globalCatalogSession.SessionSettings, 409, "UpdateRecipients", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\SystemConfigurationTasks\\RecipientPolicy\\UpdateEmailAddressPolicy.cs"); tenantOrRootOrgRecipientSession.EnforceDefaultScope = false; IEnumerable <ADRecipient> enumerable = eap.FindMatchingRecipientsPaged(globalCatalogSession, organizationId, null, fixMissingAlias); string text = null; Hashtable hashtable = new Hashtable(); foreach (ADRecipient adrecipient in enumerable) { if (cmdlet != null && cmdlet.Stopping) { return; } if (!string.IsNullOrEmpty(domainController) && string.IsNullOrEmpty(text)) { try { string configurationDomainControllerFqdn = SystemConfigurationTasksHelper.GetConfigurationDomainControllerFqdn(domainController); int num2 = configurationDomainControllerFqdn.IndexOf("."); if (0 <= num2) { text = configurationDomainControllerFqdn.Substring(num2); } } catch (SocketException ex) { writeWarning(Strings.ErrorResolveFqdnForDomainController(domainController, ex.Message)); return; } } string text2 = adrecipient.Id.DomainId.DistinguishedName.ToLowerInvariant(); if (!hashtable.ContainsKey(text2)) { SystemConfigurationTasksHelper.PrepareDomainControllerRecipientSessionForUpdate(tenantOrRootOrgRecipientSession, adrecipient.Id, domainController, text); IEnumerable <ADRecipient> collection = eap.FindMatchingRecipientsPaged(tenantOrRootOrgRecipientSession, organizationId, adrecipient.Id, fixMissingAlias); List <ADRecipient> list = new List <ADRecipient>(); Exception ex2 = null; Exception ex3 = null; try { list.AddRange(collection); } catch (DataSourceOperationException ex4) { TaskLogger.Trace("Exception caught when re-read recipient from DC : {0}", new object[] { ex4.ToString() }); if (ex4.InnerException is ActiveDirectoryObjectNotFoundException || ex4.InnerException is AuthenticationException) { ex3 = ex4; } else { ex2 = ex4; } } catch (DataSourceTransientException ex5) { TaskLogger.Trace("Exception caught when re-read recipient from DC : {0}", new object[] { ex5.ToString() }); if (ex5.InnerException is ActiveDirectoryOperationException || ex5.InnerException is ActiveDirectoryServerDownException) { ex3 = ex5; } else { ex2 = ex5; } } if (ex3 != null) { hashtable.Add(text2, null); writeWarning(Strings.ErrorCannotUpdateRecipientOfDomain(DNConvertor.FqdnFromDomainDistinguishedName(text2), ex3.Message)); } else if (ex2 != null) { writeWarning(Strings.ErrorFailedToReadRecipientForUpdate(adrecipient.Id.ToString(), ex2.Message)); } else if (1 == list.Count) { ADRecipient adrecipient2 = list[0]; if (cmdlet != null && cmdlet.Stopping) { return; } num = num++ % 99 + 1; writeProgress(Strings.ProgressActivityUpdateRecipient, Strings.ProgressStatusUpdateRecipient(adrecipient2.Id.ToString()), num); writeVerbose(Strings.ProgressStatusUpdateRecipient(adrecipient2.Id.ToString())); try { if (fixMissingAlias && string.IsNullOrEmpty(adrecipient2.Alias)) { if (adrecipient2 is ADMicrosoftExchangeRecipient) { adrecipient2.Alias = RecipientTaskHelper.GenerateUniqueAlias(globalCatalogSession, adrecipient2.OrganizationId, ADMicrosoftExchangeRecipient.DefaultName, writeVerbose); } else if (adrecipient2 is ADSystemAttendantMailbox) { adrecipient2.Alias = RecipientTaskHelper.GenerateUniqueAlias(globalCatalogSession, adrecipient2.OrganizationId, (adrecipient2 as ADSystemAttendantMailbox).ServerName + "-SA", writeVerbose); } else { adrecipient2.Alias = RecipientTaskHelper.GenerateUniqueAlias(globalCatalogSession, adrecipient2.OrganizationId, adrecipient2.Name, writeVerbose); } writeWarning(Strings.WarningGeneratingMissingAlias(adrecipient2.Identity.ToString(), adrecipient2.Alias)); } if (!adrecipient2.IsReadOnly) { ProvisioningLayer.UpdateAffectedIConfigurable(cmdlet, RecipientTaskHelper.ConvertRecipientToPresentationObject(adrecipient2), true); } if (!adrecipient2.IsValid || adrecipient2.IsReadOnly) { writeWarning(Strings.ErrorCannotUpdateInvalidRecipient(adrecipient2.Id.ToString())); } else { if (cmdlet.IsVerboseOn && adrecipient2.ObjectState != ObjectState.Unchanged) { writeVerbose(TaskVerboseStringHelper.GetConfigurableObjectChangedProperties(adrecipient2)); } tenantOrRootOrgRecipientSession.Save(adrecipient2); } } catch (DataSourceTransientException ex6) { writeWarning(Strings.ErrorUpdateRecipient(adrecipient2.Id.ToString(), ex6.Message)); TaskLogger.Trace("Exception is raised while updating recipient '{0}': {1}", new object[] { adrecipient2.Id.ToString(), ex6.Message }); } catch (DataSourceOperationException ex7) { writeWarning(Strings.ErrorUpdateRecipient(adrecipient2.Id.ToString(), ex7.Message)); TaskLogger.Trace("Exception is raised while updating recipient '{0}': {1}", new object[] { adrecipient2.Id.ToString(), ex7.Message }); } catch (DataValidationException ex8) { writeWarning(Strings.ErrorUpdateRecipient(adrecipient2.Id.ToString(), ex8.Message)); TaskLogger.Trace("Exception is raised while updating recipient '{0}': {1}", new object[] { adrecipient2.Id.ToString(), ex8.Message }); } } } } } finally { if (cmdlet != null && cmdlet.Stopping) { ExManagementApplicationLogger.LogEvent(ManagementEventLogConstants.Tuple_RecipientsUpdateForEmailAddressPolicyCancelled, new string[] { eap.Identity.ToString(), eap.LdapRecipientFilter, ADRecipientSchema.EmailAddresses.Name }); } } if (num != 0) { writeVerbose(Strings.ProgressStatusFinished); writeProgress(Strings.ProgressActivityUpdateRecipient, Strings.ProgressStatusFinished, 100); } }