private void RetrieveAllScopes(ScopeRestrictionType scopeType, ADRawEntry givenObject, out Dictionary <ADObjectId, ADScope> customScopes, out Dictionary <ADObjectId, ADScope> exclusiveScopes)
        {
            customScopes    = new Dictionary <ADObjectId, ADScope>();
            exclusiveScopes = new Dictionary <ADObjectId, ADScope>();
            ScopeType scopeType2 = ScopeType.ExclusiveConfigScope;
            ScopeType scopeType3 = ScopeType.CustomConfigScope;

            if (scopeType == ScopeRestrictionType.RecipientScope)
            {
                scopeType2 = ScopeType.ExclusiveRecipientScope;
                scopeType3 = ScopeType.CustomRecipientScope;
            }
            ADPagedReader <ManagementScope> allScopes = this.configSession.GetAllScopes(this.orgId, scopeType);

            foreach (ManagementScope managementScope in allScopes)
            {
                if (managementScope.ScopeRestrictionType == scopeType)
                {
                    ExchangeRunspaceConfiguration.TryStampQueryFilterOnManagementScope(managementScope);
                    if (managementScope.Exclusive)
                    {
                        RbacScope rbacScope = new RbacScope(scopeType2, managementScope);
                        rbacScope.PopulateRootAndFilter(this.orgId, givenObject);
                        exclusiveScopes.Add(managementScope.OriginalId, rbacScope);
                    }
                    RbacScope rbacScope2 = new RbacScope(scopeType3, managementScope);
                    rbacScope2.PopulateRootAndFilter(this.orgId, givenObject);
                    customScopes.Add(managementScope.OriginalId, rbacScope2);
                }
            }
        }
 public static void StampQueryFilterOnManagementScope(ManagementScope managementScope)
 {
     ExchangeRunspaceConfiguration.TryStampQueryFilterOnManagementScope(managementScope);
 }