Example #1
0
 protected override void InternalBeginProcessing()
 {
     TaskLogger.LogEnter();
     base.InternalBeginProcessing();
     if (base.Fields.IsModified(DynamicDistributionGroupSchema.RecipientFilter))
     {
         DynamicDistributionGroup adObject = (DynamicDistributionGroup)this.GetDynamicParameters();
         if (RecipientFilterHelper.IsRecipientFilterPropertiesModified(adObject, false))
         {
             base.ThrowTerminatingError(new TaskArgumentException(Strings.ErrorBothCustomAndPrecannedFilterSpecified, null), ExchangeErrorCategory.Client, null);
         }
     }
     if (base.Fields.IsModified("ExpansionServer"))
     {
         if (string.IsNullOrEmpty(this.ExpansionServer))
         {
             this.ExpansionServer = string.Empty;
             this.homeMTA         = null;
         }
         else
         {
             Server server = SetDynamicDistributionGroup.ResolveExpansionServer(this.ExpansionServer, base.GlobalConfigSession, new DataAccessHelper.CategorizedGetDataObjectDelegate(base.GetDataObject <Server>), new Task.ErrorLoggerDelegate(base.ThrowTerminatingError));
             base.ValidateExpansionServer(server, true);
             this.ExpansionServer = server.ExchangeLegacyDN;
             this.homeMTA         = server.ResponsibleMTA;
         }
     }
     TaskLogger.LogExit();
 }
        protected override void ValidateWrite(List <ValidationError> errors)
        {
            base.ValidateWrite(errors);
            ProxyAddressTemplateCollection proxyAddressTemplateCollection = (ProxyAddressTemplateCollection)this[EmailAddressPolicySchema.RawEnabledEmailAddressTemplates];
            ProxyAddressTemplateCollection disabledEmailAddressTemplates  = this.DisabledEmailAddressTemplates;
            List <ProxyAddressTemplate>    list = new List <ProxyAddressTemplate>();

            list.AddRange(proxyAddressTemplateCollection);
            list.AddRange(disabledEmailAddressTemplates);
            if (list.Count > 0)
            {
                if (proxyAddressTemplateCollection != null && disabledEmailAddressTemplates != null)
                {
                    foreach (ProxyAddressTemplate proxyAddressTemplate in proxyAddressTemplateCollection)
                    {
                        if (disabledEmailAddressTemplates.Contains(proxyAddressTemplate))
                        {
                            errors.Add(new ObjectValidationError(DirectoryStrings.EapDuplicatedEmailAddressTemplate(proxyAddressTemplate.ToString()), base.Id, string.Empty));
                        }
                    }
                }
                Dictionary <ProxyAddressPrefix, int> dictionary = new Dictionary <ProxyAddressPrefix, int>();
                foreach (ProxyAddressTemplate proxyAddressTemplate2 in list)
                {
                    if (!dictionary.ContainsKey(proxyAddressTemplate2.Prefix))
                    {
                        dictionary[proxyAddressTemplate2.Prefix] = 0;
                    }
                    if (proxyAddressTemplate2.IsPrimaryAddress)
                    {
                        Dictionary <ProxyAddressPrefix, int> dictionary2;
                        ProxyAddressPrefix prefix;
                        (dictionary2 = dictionary)[prefix = proxyAddressTemplate2.Prefix] = dictionary2[prefix] + 1;
                    }
                }
                foreach (ProxyAddressPrefix proxyAddressPrefix in dictionary.Keys)
                {
                    if ((!(proxyAddressPrefix == ProxyAddressPrefix.Smtp) || dictionary[proxyAddressPrefix] != 0) && dictionary[proxyAddressPrefix] != 1)
                    {
                        errors.Add(new ObjectValidationError(DirectoryStrings.EapMustHaveOnePrimaryAddressTemplate(proxyAddressPrefix.ToString()), base.Id, string.Empty));
                    }
                }
            }
            ValidationError validationError = RecipientFilterHelper.ValidatePrecannedRecipientFilter(this.propertyBag, EmailAddressPolicySchema.RecipientFilterMetadata, EmailAddressPolicySchema.RecipientFilter, EmailAddressPolicySchema.IncludedRecipients, this.Identity);

            if (validationError != null)
            {
                errors.Add(validationError);
            }
            if (this.Priority == 0 && (base.IsChanged(EmailAddressPolicySchema.Priority) || base.ObjectState == ObjectState.New))
            {
                errors.Add(new PropertyValidationError(DirectoryStrings.CannotSetZeroAsEapPriority, EmailAddressPolicySchema.Priority, string.Empty));
            }
            if (string.IsNullOrEmpty(this.RecipientFilter) && (base.IsModified(EmailAddressPolicySchema.RecipientFilter) || base.ObjectState == ObjectState.New))
            {
                errors.Add(new PropertyValidationError(DirectoryStrings.ErrorInvalidOpathFilter(this.RecipientFilter ?? string.Empty), EmailAddressPolicySchema.RecipientFilter, string.Empty));
            }
        }
        // Token: 0x06000066 RID: 102 RVA: 0x00003074 File Offset: 0x00001274
        private static ADUser[] GlobalFindAllArbitrationMailboxes()
        {
            Server localhost = AuditLogSearchContext.Localhost;

            if (!MapiTaskHelper.IsDatacenter)
            {
                IRecipientSession tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(true, ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 99, "GlobalFindAllArbitrationMailboxes", "f:\\15.00.1497\\sources\\dev\\Management\\src\\ServiceHost\\Servicelets\\AuditLogSearch\\Program\\AuditLogSearchServicelet.cs");
                return(tenantOrRootOrgRecipientSession.FindPaged <ADUser>(RecipientFilterHelper.DiscoveryMailboxFilterForAuditLog(localhost.ExchangeLegacyDN), null, true, null, 0).ToArray <ADUser>());
            }
            return(PartitionDataAggregator.FindAllArbitrationMailboxes(localhost.ExchangeLegacyDN));
        }
 protected override void InternalValidate()
 {
     TaskLogger.LogEnter();
     base.InternalValidate();
     if (base.HasErrors)
     {
         return;
     }
     RecipientFilterHelper.StampE2003FilterMetadata(this.DataObject, this.DataObject.LdapRecipientFilter, EmailAddressPolicySchema.PurportedSearchUI);
     this.domainValidator.Validate(this.DataObject);
     TaskLogger.LogExit();
 }
        protected override void InternalBeginProcessing()
        {
            TaskLogger.LogEnter();
            base.InternalBeginProcessing();
            AddressListBase adObject = (TRepresentationObject)((object)this.GetDynamicParameters());

            if (base.Fields.IsModified(AddressListBaseSchema.RecipientFilter) && RecipientFilterHelper.IsRecipientFilterPropertiesModified(adObject, false))
            {
                base.ThrowTerminatingError(new ArgumentException(Strings.ErrorBothCustomAndPrecannedFilterSpecified, null), ErrorCategory.InvalidArgument, null);
            }
            TaskLogger.LogExit();
        }
Example #6
0
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     if (RecipientFilterHelper.FixExchange12RecipientFilterMetadata(this.DataObject, ADObjectSchema.ExchangeVersion, ADDynamicGroupSchema.PurportedSearchUI, ADDynamicGroupSchema.RecipientFilterMetadata, string.Empty))
     {
         base.WriteVerbose(Strings.WarningFixTheInvalidRecipientFilterMetadata(this.Identity.ToString()));
     }
     if (!base.IsUpgrading || this.ForceUpgrade || base.ShouldContinue(Strings.ContinueUpgradeObjectVersion(this.DataObject.Name)))
     {
         base.InternalProcessRecord();
     }
     TaskLogger.LogExit();
 }
 internal void SetRecipientFilter(QueryFilter filter)
 {
     if (filter == null)
     {
         this[EmailAddressPolicySchema.RecipientFilter]     = string.Empty;
         this[EmailAddressPolicySchema.LdapRecipientFilter] = string.Empty;
     }
     else
     {
         this[EmailAddressPolicySchema.RecipientFilter]     = filter.GenerateInfixString(FilterLanguage.Monad);
         this[EmailAddressPolicySchema.LdapRecipientFilter] = LdapFilterBuilder.LdapFilterFromQueryFilter(filter);
     }
     RecipientFilterHelper.SetRecipientFilterType(WellKnownRecipientFilterType.Custom, this.propertyBag, EmailAddressPolicySchema.RecipientFilterMetadata);
 }
Example #8
0
 protected override void InternalValidate()
 {
     TaskLogger.LogEnter();
     this.CheckLimit();
     base.InternalValidate();
     if (base.HasErrors)
     {
         return;
     }
     if (this.DataObject.IsModified(AddressBookBaseSchema.LdapRecipientFilter))
     {
         RecipientFilterHelper.StampE2003FilterMetadata(this.DataObject, this.DataObject.LdapRecipientFilter, AddressBookBaseSchema.PurportedSearchUI);
     }
     TaskLogger.LogExit();
 }
Example #9
0
        protected override void InternalBeginProcessing()
        {
            TaskLogger.LogEnter();
            base.InternalBeginProcessing();
            EmailAddressPolicy emailAddressPolicy = (EmailAddressPolicy)this.GetDynamicParameters();

            if (base.Fields.IsModified(EmailAddressPolicySchema.RecipientFilter) && RecipientFilterHelper.IsRecipientFilterPropertiesModified(emailAddressPolicy, false))
            {
                base.ThrowTerminatingError(new ArgumentException(Strings.ErrorBothCustomAndPrecannedFilterSpecified, null), ErrorCategory.InvalidArgument, null);
            }
            if (emailAddressPolicy.IsModified(EmailAddressPolicySchema.EnabledPrimarySMTPAddressTemplate) && emailAddressPolicy.IsModified(EmailAddressPolicySchema.EnabledEmailAddressTemplates))
            {
                base.ThrowTerminatingError(new ArgumentException(Strings.ErrorEnabledPrimarySmtpAndEmailAddressTemplatesSpecified, null), ErrorCategory.InvalidArgument, null);
            }
            TaskLogger.LogExit();
        }
        private void CreateCannedAddressList(string name, QueryFilter recipientFilter)
        {
            bool flag = string.Equals(name, CannedAddressListsFilterHelper.DefaultAllModernGroups, StringComparison.InvariantCulture);

            if (flag && (!this.CreateModernGroupsAddressList.IsPresent || !VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).CmdletInfra.InstallModernGroupsAddressList.Enabled))
            {
                return;
            }
            ADObjectId id = this.DataObject.Id;

            AddressBookBase[] array = this.FindAddressList(name, recipientFilter);
            if (array == null || array.Length == 0)
            {
                AddressBookBase addressBookBase = new AddressBookBase();
                string          text            = name;
                if (flag)
                {
                    text = Strings.DefaultAllGroups;
                    addressBookBase.IsModernGroupsAddressList = true;
                }
                ADObjectId childId = id.GetChildId(text);
                addressBookBase.SetId(childId);
                addressBookBase.DisplayName = text;
                addressBookBase.SetRecipientFilter(recipientFilter);
                RecipientFilterHelper.StampE2003FilterMetadata(addressBookBase, addressBookBase.LdapRecipientFilter, AddressBookBaseSchema.PurportedSearchUI);
                addressBookBase.OrganizationId = (base.CurrentOrganizationId ?? OrganizationId.ForestWideOrgId);
                base.WriteVerbose(TaskVerboseStringHelper.GetSaveObjectVerboseString(addressBookBase, base.DataSession, typeof(AddressBookBase)));
                try
                {
                    base.DataSession.Save(addressBookBase);
                    if (string.Equals(name, CannedAddressListsFilterHelper.DefaultAllRooms, StringComparison.InvariantCulture))
                    {
                        this.PostOrganization(childId);
                    }
                }
                catch (ADObjectAlreadyExistsException)
                {
                    base.WriteVerbose(Strings.VerboseCannedAddressListAlreadyExists(name));
                }
                finally
                {
                    base.WriteVerbose(TaskVerboseStringHelper.GetSourceVerboseString(base.DataSession));
                }
                base.WriteObject(addressBookBase);
            }
        }
Example #11
0
        protected override void InternalProcessRecord()
        {
            if (!this.isContainerExisted)
            {
                base.InternalProcessRecord();
            }
            QueryFilter           filter = new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.Name, EmailAddressPolicy.DefaultName);
            IConfigurationSession configurationSession  = (IConfigurationSession)base.DataSession;
            ADObjectId            currentOrgContainerId = base.CurrentOrgContainerId;

            EmailAddressPolicy[] array = configurationSession.Find <EmailAddressPolicy>(currentOrgContainerId, QueryScope.SubTree, filter, null, 0);
            if (array == null || array.Length == 0)
            {
                EmailAddressPolicy emailAddressPolicy = new EmailAddressPolicy();
                emailAddressPolicy.SetId(this.DataObject.Id.GetChildId(EmailAddressPolicy.DefaultName));
                emailAddressPolicy[EmailAddressPolicySchema.Enabled] = true;
                emailAddressPolicy.Priority = EmailAddressPolicyPriority.Lowest;
                if (Datacenter.GetExchangeSku() == Datacenter.ExchangeSku.Enterprise)
                {
                    emailAddressPolicy.RecipientFilterApplied = true;
                }
                emailAddressPolicy.IncludedRecipients = new WellKnownRecipientType?(WellKnownRecipientType.AllRecipients);
                if (this.DomainName == null)
                {
                    emailAddressPolicy.EnabledPrimarySMTPAddressTemplate = "@" + DNConvertor.FqdnFromDomainDistinguishedName(currentOrgContainerId.DomainId.DistinguishedName);
                }
                else
                {
                    emailAddressPolicy.EnabledPrimarySMTPAddressTemplate = "@" + this.DomainName.ToString();
                }
                RecipientFilterHelper.StampE2003FilterMetadata(emailAddressPolicy, emailAddressPolicy.LdapRecipientFilter, EmailAddressPolicySchema.PurportedSearchUI);
                if (base.CurrentOrganizationId != null)
                {
                    emailAddressPolicy.OrganizationId = base.CurrentOrganizationId;
                }
                else
                {
                    emailAddressPolicy.OrganizationId = base.ExecutingUserOrganizationId;
                }
                configurationSession.Save(emailAddressPolicy);
            }
        }
Example #12
0
        private void CreateDefaultGal(ADObjectId defaultGal)
        {
            AddressBookBase addressBookBase = new AddressBookBase();

            addressBookBase.SetId(defaultGal);
            addressBookBase.DisplayName = defaultGal.Name;
            addressBookBase.SetRecipientFilter(GlobalAddressList.RecipientFilterForDefaultGal);
            addressBookBase[AddressBookBaseSchema.RecipientFilterFlags] = (RecipientFilterableObjectFlags.FilterApplied | RecipientFilterableObjectFlags.IsDefault);
            RecipientFilterHelper.StampE2003FilterMetadata(addressBookBase, addressBookBase.LdapRecipientFilter, AddressBookBaseSchema.PurportedSearchUI);
            addressBookBase.OrganizationId = (base.CurrentOrganizationId ?? OrganizationId.ForestWideOrgId);
            base.WriteVerbose(TaskVerboseStringHelper.GetSaveObjectVerboseString(addressBookBase, base.DataSession, typeof(AddressBookBase)));
            try
            {
                base.DataSession.Save(addressBookBase);
            }
            finally
            {
                base.WriteVerbose(TaskVerboseStringHelper.GetSourceVerboseString(base.DataSession));
            }
            base.WriteObject(addressBookBase);
        }
Example #13
0
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            if (RecipientFilterHelper.FixExchange12RecipientFilterMetadata(this.DataObject, ADObjectSchema.ExchangeVersion, EmailAddressPolicySchema.PurportedSearchUI, EmailAddressPolicySchema.RecipientFilterMetadata, this.DataObject.LdapRecipientFilter))
            {
                base.WriteVerbose(Strings.WarningFixTheInvalidRecipientFilterMetadata(this.Identity.ToString()));
            }
            bool flag = this.affectedPolicies != null && this.affectedPolicies.Length > 0;
            List <EmailAddressPolicy> list = new List <EmailAddressPolicy>();

            try
            {
                if (!base.IsUpgrading || this.ForceUpgrade || base.ShouldContinue(Strings.ContinueUpgradeObjectVersion(this.DataObject.Name)))
                {
                    if (this.DataObject.IsChanged(EmailAddressPolicySchema.Priority))
                    {
                        for (int i = 0; i < this.affectedPolicies.Length; i++)
                        {
                            if (flag)
                            {
                                base.WriteProgress(Strings.ProgressEmailAddressPolicyPreparingPriority, Strings.ProgressEmailAddressPolicyAdjustingPriority(this.affectedPolicies[i].Identity.ToString()), i * 99 / this.affectedPolicies.Length + 1);
                            }
                            bool recipientFilterApplied = this.affectedPolicies[i].RecipientFilterApplied;
                            if (!this.affectedPolicies[i].ExchangeVersion.IsOlderThan(EmailAddressPolicySchema.RecipientFilterApplied.VersionAdded))
                            {
                                this.affectedPolicies[i][EmailAddressPolicySchema.RecipientFilterApplied] = false;
                            }
                            base.DataSession.Save(this.affectedPolicies[i]);
                            if (!this.affectedPolicies[i].ExchangeVersion.IsOlderThan(EmailAddressPolicySchema.RecipientFilterApplied.VersionAdded))
                            {
                                this.affectedPolicies[i][EmailAddressPolicySchema.RecipientFilterApplied] = recipientFilterApplied;
                            }
                            this.affectedPolicies[i].Priority = this.affectedPoliciesOriginalPriority[i];
                            list.Add(this.affectedPolicies[i]);
                        }
                    }
                    base.InternalProcessRecord();
                    if (!base.HasErrors)
                    {
                        list.Clear();
                    }
                }
            }
            finally
            {
                for (int j = 0; j < list.Count; j++)
                {
                    EmailAddressPolicy emailAddressPolicy = list[j];
                    try
                    {
                        if (flag)
                        {
                            base.WriteProgress(Strings.ProgressEmailAddressPolicyPreparingPriority, Strings.ProgressEmailAddressPolicyRollingBackPriority(emailAddressPolicy.Identity.ToString()), j * 99 / list.Count + 1);
                        }
                        base.DataSession.Save(emailAddressPolicy);
                    }
                    catch (DataSourceTransientException)
                    {
                        this.WriteWarning(Strings.VerboseFailedToRollbackPriority(emailAddressPolicy.Id.ToString()));
                    }
                }
            }
            TaskLogger.LogExit();
        }
Example #14
0
        protected override void StampChangesOn(IConfigurable dataObject)
        {
            EmailAddressPolicy emailAddressPolicy = (EmailAddressPolicy)dataObject;
            bool flag = EmailAddressPolicyPriority.Lowest == emailAddressPolicy.Priority;

            if (flag)
            {
                if (this.Instance.IsChanged(ADObjectSchema.RawName) || ((EmailAddressPolicy)this.GetDynamicParameters()).IsChanged(ADObjectSchema.Name) || this.Instance.IsChanged(EmailAddressPolicySchema.Priority) || this.Instance.IsChanged(EmailAddressPolicySchema.RecipientContainer) || ((EmailAddressPolicy)this.GetDynamicParameters()).IsChanged(EmailAddressPolicySchema.RecipientContainer) || base.Fields.IsModified("RecipientContainer"))
                {
                    base.WriteError(new InvalidOperationException(Strings.ErrorInvalidOperationOnLowestEap(dataObject.Identity.ToString())), ErrorCategory.InvalidOperation, dataObject.Identity);
                }
                if (!emailAddressPolicy.ExchangeVersion.IsOlderThan(EmailAddressPolicySchema.RecipientFilter.VersionAdded) && (base.Fields.IsModified(EmailAddressPolicySchema.RecipientFilter) || RecipientFilterHelper.IsRecipientFilterPropertiesModified((ADObject)this.GetDynamicParameters(), false) || RecipientFilterHelper.IsRecipientFilterPropertiesModified(this.Instance, true)))
                {
                    base.WriteError(new InvalidOperationException(Strings.ErrorInvalidOperationOnLowestEap(dataObject.Identity.ToString())), ErrorCategory.InvalidOperation, dataObject.Identity);
                }
            }
            base.StampChangesOn(dataObject);
            if (base.Fields.IsModified(EmailAddressPolicySchema.RecipientFilter))
            {
                emailAddressPolicy.SetRecipientFilter(this.innerFilter);
            }
            if (flag && emailAddressPolicy.IsChanged(EmailAddressPolicySchema.LdapRecipientFilter) && !string.Equals(emailAddressPolicy.LdapRecipientFilter, LdapFilterBuilder.LdapFilterFromQueryFilter(EmailAddressPolicy.RecipientFilterForDefaultPolicy), StringComparison.OrdinalIgnoreCase))
            {
                base.WriteError(new InvalidOperationException(Strings.ErrorInvalidFilterForLowestEap(this.Identity.ToString(), emailAddressPolicy.RecipientFilter)), ErrorCategory.InvalidOperation, dataObject.Identity);
            }
        }
 protected override bool ShouldUpgradeExchangeVersion(ADObject adObject)
 {
     return(base.Fields.IsModified(AddressListBaseSchema.RecipientFilter) || RecipientFilterHelper.IsRecipientFilterPropertiesModified(adObject, false));
 }
        public static ADUser[] FindAllArbitrationMailboxes(string legDN)
        {
            List <ADUser> list = new List <ADUser>();

            foreach (PartitionId partitionId in ADAccountPartitionLocator.GetAllAccountPartitionIds())
            {
                IRecipientSession tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(true, ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromAllTenantsPartitionId(partitionId), 367, "FindAllArbitrationMailboxes", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\PartitionDataAggregator.cs");
                ADUser[]          collection = tenantOrRootOrgRecipientSession.FindPaged <ADUser>(RecipientFilterHelper.DiscoveryMailboxFilterForAuditLog(legDN), null, true, null, 0).ToArray <ADUser>();
                list.AddRange(collection);
            }
            return(list.ToArray());
        }
Example #17
0
        private IList <ExchangePrincipal> GetSyncMailboxPrincipals(Guid mailboxDatabaseGuid, IDirectorySession configSession)
        {
            List <ExchangePrincipal> list = new List <ExchangePrincipal>();
            ADObjectId id = new ADObjectId(mailboxDatabaseGuid);

            Result <MailboxDatabase>[] dataBases         = null;
            ADOperationResult          adoperationResult = ADNotificationAdapter.TryRunADOperation(delegate()
            {
                dataBases = configSession.FindByADObjectIds <MailboxDatabase>(new ADObjectId[]
                {
                    id
                });
            }, 3);

            if (!adoperationResult.Succeeded)
            {
                this.logger.LogOneEntry("NotificationLoader", string.Empty, ExecutionLog.EventType.Error, string.Format("GetSyncMailboxPrincipals: failed to find database {0} in active directory because of {1}", mailboxDatabaseGuid, adoperationResult.Exception), adoperationResult.Exception);
            }
            if (dataBases != null && dataBases.Length > 0)
            {
                PartitionId[] allAccountPartitionIds = ADAccountPartitionLocator.GetAllAccountPartitionIds();
                for (int i = 0; i < allAccountPartitionIds.Length; i++)
                {
                    PartitionId       partitionId      = allAccountPartitionIds[i];
                    IRecipientSession recipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(true, ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromAllTenantsPartitionId(partitionId), 238, "GetSyncMailboxPrincipals", "f:\\15.00.1497\\sources\\dev\\data\\src\\storage\\UnifiedPolicy\\NotificationLoader.cs");
                    ADUser[]          arbMbxs          = null;
                    adoperationResult = ADNotificationAdapter.TryRunADOperation(delegate()
                    {
                        arbMbxs = recipientSession.FindPaged <ADUser>(RecipientFilterHelper.DiscoveryMailboxFilterUnifiedPolicy(dataBases[0].Data.Id), null, true, null, 0).ToArray <ADUser>();
                    }, 3);
                    if (!adoperationResult.Succeeded)
                    {
                        this.logger.LogOneEntry("NotificationLoader", string.Empty, ExecutionLog.EventType.Error, string.Format("GetSyncMailboxPrincipals: failed to find sync mailboxes in database {0} in active directory because of {1}", mailboxDatabaseGuid, adoperationResult.Exception), adoperationResult.Exception);
                    }
                    if (arbMbxs != null && arbMbxs.Length > 0)
                    {
                        ADUser[] arbMbxs2 = arbMbxs;
                        int      j        = 0;
                        while (j < arbMbxs2.Length)
                        {
                            ADUser aduser = arbMbxs2[j];
                            this.logger.LogOneEntry("NotificationLoader", string.Empty, ExecutionLog.EventType.Verbose, string.Format("GetSyncMailboxPrincipals: found sync mailbox {0} in database {1} in partition {2}", aduser.UserPrincipalName, mailboxDatabaseGuid, partitionId), null);
                            ExchangePrincipal item = null;
                            try
                            {
                                item = ExchangePrincipal.FromADUser(ADSessionSettings.FromOrganizationIdWithoutRbacScopesServiceOnly(aduser.OrganizationId), aduser, RemotingOptions.LocalConnectionsOnly);
                            }
                            catch (StoragePermanentException exception)
                            {
                                this.logger.LogOneEntry("NotificationLoader", string.Empty, ExecutionLog.EventType.Error, string.Format("GetSyncMailboxPrincipals: sync mailbox {0} is skipped because of StoragePermanentException in ExchangePrincipal construction", aduser.UserPrincipalName), exception);
                                goto IL_20F;
                            }
                            catch (StorageTransientException exception2)
                            {
                                this.logger.LogOneEntry("NotificationLoader", string.Empty, ExecutionLog.EventType.Error, string.Format("GetSyncMailboxPrincipals: sync mailbox {0} is skipped because of StorageTransientException in ExchangePrincipal construction", aduser.UserPrincipalName), exception2);
                                goto IL_20F;
                            }
                            goto IL_207;
IL_20F:
                            j++;
                            continue;
IL_207:
                            list.Add(item);
                            goto IL_20F;
                        }
                    }
                    else
                    {
                        this.logger.LogOneEntry("NotificationLoader", string.Empty, ExecutionLog.EventType.Verbose, string.Format("GetSyncMailboxPrincipals: there is no sync mailboxes in database {0} in active directory", mailboxDatabaseGuid), null);
                    }
                }
            }
            return(list);
        }
Example #18
0
 protected override bool ShouldUpgradeExchangeVersion(ADObject adObject)
 {
     return(base.ShouldUpgradeExchangeVersion(adObject) || base.Fields.IsModified(DynamicDistributionGroupSchema.RecipientFilter) || RecipientFilterHelper.IsRecipientFilterPropertiesModified(adObject, false));
 }