Пример #1
0
        public static void PopulateScopes(Dictionary <string, string> scopeLookup)
        {
            SPSecurity.RunWithElevatedPrivileges(
                delegate
            {
                var ssaProxy =
                    (SearchServiceApplicationProxy)
                    SearchServiceApplicationProxy.GetProxy(SPServiceContext.Current);

                var searchApplictionInfo = ssaProxy.GetSearchServiceApplicationInfo();
                var searchApplication    =
                    SearchService.Service.SearchApplications.GetValue <SearchServiceApplication>(
                        searchApplictionInfo.SearchServiceApplicationId);
                Scopes scopes = new Scopes(searchApplication);
                foreach (Scope scope in scopes.GetScopesForSite(null))
                {
                    if (!string.IsNullOrEmpty(scope.Filter))
                    {
                        scopeLookup[scope.Name.ToLower()] = scope.Filter;
                    }
                }
            }
                );
        }