Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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.

share|improve this question
add comment

3 Answers

up vote 2 down vote accepted

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;

crawlRule.Update();

the securityTrimmerId refers to the id of your custom SecurityTrimmer

Hope it helps!

share|improve this answer
add comment

have you followed the original msdn documentation :

http://msdn.microsoft.com/en-us/library/ee819923.aspx

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=1.0.0.0, Culture=neutral, PublicKeyToken=token" -RulePath file://FileServer1/* -id 1

check the link

gl

share|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
add comment

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());

share|improve this answer
add comment

Your Answer

 
discard

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.