SharePoint 2010 changed a lot of things about security trimming from 2007. I've implemented the new ISecurityTrimmer2 interface, and I've registered my trimmer with SharePoint (following the suggestions here). However, my trimmer is not consulted during a search. There are messages in the logs about security trimming, like "PluggableSecurityTrimmerManager:SetSearchApplicationToUse: Set SearchApplication to 'Search Service Application'". Any ideas what I'm doing wrong? Is there a necessary step in addition to registering the trimmer? If it matters, I'm using BDC to allow SharePoint to crawl my content, and this part is successful.

Most of the documentation on the web deals with registering security trimmers using PowerShell. For ease of deployment, I'm registering from C# code running during installation. One difference in the approaches which may explain the behaviors is that the PowerShell command takes a crawl rule, while the PluggableSecurityTrimmerManager does not.


using code you can do the same thing but you will have to manipulate multiple objects

PluggableSecurityTrimmerManager as you know

and then CrawlRule

using this CrawlRule object, you can do things like

SearchAdmin.CrawlRule crawlRule = content.CrawlRules.Create(SearchAdmin.CrawlRuleType.InclusionRule, "yourRulePath");

crawlRule.PluggableSecurityTrimmerId = securityTrimmerId;


the securityTrimmerId refers to the id of your custom SecurityTrimmer

Hope it helps!

| improve this answer | |

have you followed the original msdn documentation :


every steps is listed there; you cannot get it wrong!

edit: there is indeed a comamand you should execute to register the trimmer

New-SPEnterpriseSearchSecurityTrimmer -SearchApplication "Search Service Application" -typeName "CustomSecurityTrimmerSample.CustomSecurityTrimmer, CustomSecurityTrimmerSample, Version=, Culture=neutral, PublicKeyToken=token" -RulePath file://FileServer1/* -id 1

check the link


| improve this answer | |
  • Thanks for your answer. I've updated the question to specify that I'm not using PowerShell. – bmm6o Mar 29 '11 at 16:51

It is mandatory to register your trimmer with the Search Service Application. For that ,make sure you use PluggableSecurityTrimmerManager.SetSearchApplicationToUse method and provide correct Search Service Application name configured in your farm.Below is the code to do that:

SPFarm farm = SPFarm.Local; SearchService searchService = farm.Services.GetValue(); SearchServiceApplication searchServApp = searchService.SearchApplications.GetValue([SearchApplicationName])();

PluggableSecurityTrimmerManager trimmerManager = PluggableSecurityTrimmerManager.Instance; trimmerManager.SetSearchApplicationToUse(searchServApp); trimmerManager.RegisterPluggableSecurityTrimmer(id, assemblyQualifiedName, new NameValueCollection());

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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