SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm currently working with a client, one of the requirements is that users have complete access to the search results, regardless user permissions, including anonymous users, Is there a way to disable security trimming?, I have tried running the core results web part with elevated privileges but it doesn’t seem to work for anonymous users.


share|improve this question
maybe by setting a policy for a specific user on the web application ? – Steve B Jun 18 '12 at 15:30
up vote 1 down vote accepted

I finally found how to run the core results webpart with elevated privileges, here is the code in case someone else needs it:

    protected override XPathNavigator GetXPathNavigator(string viewPath)
        XmlDocument CustomXml = null;
        string UserQuery = "";
        QueryManager QM = SharedQueryManager.GetInstance(Page, QueryNumber).QueryManager;
        UserQuery = QM.UserQuery;
        QueryManager SourceManager = SharedQueryManager.GetInstance(Page, QueryNumber).QueryManager;   
            SearchQueryAndSiteSettingsServiceProxy settingsProxy = SPFarm.Local.ServiceProxies.GetValue<SearchQueryAndSiteSettingsServiceProxy>();
            SearchServiceApplicationProxy searchProxy = settingsProxy.ApplicationProxies.GetValue<SearchServiceApplicationProxy>("Search Service Application");
            QueryManager queryManager = new QueryManager();
            LocationList LocalList = new LocationList();
            Location localSearchLocation = new Location("LocalSearchIndex", searchProxy);
            queryManager.UserQuery = UserQuery;
            CustomXml = queryManager.GetResults(LocalList);
        XPathNavigator xPathNavigator = CustomXml.CreateNavigator(); 
        return xPathNavigator;

Edit: Although this works to get all the search results, the refinement panel, and paging web part stopped working, I’m currently looking for a way to fix this.

share|improve this answer
I have tried your solution it is working fine thanks for shearing this code. Now i am facing same problem "refinement panel, and paging web part stopped working" for that i have created new thread so could you please answer the following link if you have any solution for that… – Pankaj Apr 29 '13 at 6:45… solves your issue – ali Sharepoint Apr 29 '13 at 9:37
I added an answer to the above referenced question about refinement panels: – lgaud Sep 24 '13 at 17:16

You could try calling the Search web service from elevated code. Just a thought, never tried it before. FWIW this seems like a really odd requirement :)

share|improve this answer
Thanks! I will give it a try, and yes it’s a really an odd requirement the reason they gave us for wanting this is that they want to expose all of their content in the search results page, and if the user clicks the element and he/she doesn’t have the necessary permissions, the user will have to e-mail a specific person or a group of people and ask for permissions, and they will check if the user really needs to see that content. – Hugo Molina Jun 14 '12 at 16:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.