static CannedSystemAddressLists()
 {
     CannedSystemAddressLists.RecipientFilters.Add("All Recipients(VLV)", CannedSystemAddressLists.GetOrFilter(CannedSystemAddressLists.RecipientTypeDetailsForAllRecipientsAL));
     CannedSystemAddressLists.SystemFlags.Add("All Recipients(VLV)", true);
     CannedSystemAddressLists.RecipientFilters.Add("All Mailboxes(VLV)", CannedSystemAddressLists.GetOrFilter(CannedSystemAddressLists.RecipientTypeDetailsForAllMailboxesAL));
     CannedSystemAddressLists.SystemFlags.Add("All Mailboxes(VLV)", true);
     CannedSystemAddressLists.RecipientFilters.Add("All Groups(VLV)", CannedSystemAddressLists.GetOrFilter(CannedSystemAddressLists.RecipientTypeDetailsForAllGroupsAL));
     CannedSystemAddressLists.SystemFlags.Add("All Groups(VLV)", true);
     CannedSystemAddressLists.RecipientFilters.Add("All Mail Users(VLV)", CannedSystemAddressLists.GetOrFilter(CannedSystemAddressLists.RecipientTypeDetailsForAllMailUsersAL));
     CannedSystemAddressLists.SystemFlags.Add("All Mail Users(VLV)", true);
     CannedSystemAddressLists.RecipientFilters.Add("All Contacts(VLV)", CannedSystemAddressLists.GetOrFilter(CannedSystemAddressLists.RecipientTypeDetailsForAllContactsAL));
     CannedSystemAddressLists.SystemFlags.Add("All Contacts(VLV)", true);
     CannedSystemAddressLists.RecipientFilters.Add("Groups(VLV)", CannedSystemAddressLists.RecipientFilters["All Groups(VLV)"]);
     CannedSystemAddressLists.SystemFlags.Add("Groups(VLV)", false);
     CannedSystemAddressLists.RecipientFilters.Add("Mailboxes(VLV)", CannedSystemAddressLists.RecipientFilters["All Mailboxes(VLV)"]);
     CannedSystemAddressLists.SystemFlags.Add("Mailboxes(VLV)", false);
     CannedSystemAddressLists.RecipientFilters.Add("TeamMailboxes(VLV)", CannedSystemAddressLists.GetOrFilter(CannedSystemAddressLists.RecipientTypeDetailsForAllTeamMailboxesAL));
     CannedSystemAddressLists.SystemFlags.Add("TeamMailboxes(VLV)", true);
     CannedSystemAddressLists.RecipientFilters.Add("PublicFolderMailboxes(VLV)", CannedSystemAddressLists.GetOrFilter(CannedSystemAddressLists.RecipientTypeDetailsForAllPublicFolderMailboxesAL));
     CannedSystemAddressLists.SystemFlags.Add("PublicFolderMailboxes(VLV)", true);
     CannedSystemAddressLists.RecipientFilters.Add("MailPublicFolders(VLV)", CannedSystemAddressLists.GetOrFilter(CannedSystemAddressLists.RecipientTypeDetailsForMailPublicFoldersAL));
     CannedSystemAddressLists.SystemFlags.Add("MailPublicFolders(VLV)", true);
     CannedSystemAddressLists.RecipientFilters.Add("GroupMailboxes(VLV)", CannedSystemAddressLists.GetOrFilter(CannedSystemAddressLists.RecipientTypeDetailsForGroupMailboxesAL));
     CannedSystemAddressLists.SystemFlags.Add("GroupMailboxes(VLV)", true);
 }
        private static int GetBruteForceCountImmediate(string domainController, OrganizationId orgId, string systemAddressListName, int countQuota)
        {
            QueryFilter filter;

            if (!CannedSystemAddressLists.GetFilterByAddressList(systemAddressListName, out filter))
            {
                throw new ArgumentException("SystemAddressListName");
            }
            ADSessionSettings             sessionSettings = ADSessionSettings.FromOrganizationIdWithoutRbacScopes(ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest(), orgId, null, false);
            IRecipientSession             tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(domainController, true, ConsistencyMode.PartiallyConsistent, sessionSettings, 278, "GetBruteForceCountImmediate", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\SystemConfiguration\\ConfigurationCache\\SystemAddressListMemberCount.cs");
            ADPagedReader <MiniRecipient> adpagedReader = tenantOrRootOrgRecipientSession.FindPagedMiniRecipient <MiniRecipient>(null, QueryScope.OneLevel, filter, null, 0, new PropertyDefinition[]
            {
                ADObjectSchema.Id
            });
            int num = 0;

            foreach (MiniRecipient miniRecipient in adpagedReader)
            {
                num++;
                if (num >= countQuota)
                {
                    return(num);
                }
            }
            return(num);
        }