I have a business requirement where I need to take the current user, and based on certain user properties, filter out User profile properties such as fax/phone etc if the current user does not meet certain business rules. Basically this solution has it's own extremely complex user profile privacy requirements.

The logic for this is surfaced via the user profile service, getting this is not the issue - the issue is where in the search pipeline can I implement this business logic so the properties are empty when they hit the display template render process?

I've looked at extending the search results web part, but as things are done client side I don't think I can implement here - my next step is to look at a Post security trimmer, but believe this filters out whole results not just properties.

SP2013, On premises, highly customised.

Any one faced a similar problem?

  • Thanks Luis, it's looking like I'll need to do it at the display template level but I'd prefer not to as I'd rather not have the properties surfaced at all.
    – GavH
    Aug 13, 2014 at 22:43
  • being On premises, a very "custom code" option could be create a service/handler (.ashx). In your service, you can use the Search classes to run the query (KeywordQuery class I think) and then iterate through the returned results, applying your business rules, and returning some kind of JSON with all the info you need to show (trimming the properties you don't want to show for the specific users). This makes sense?? Aug 22, 2014 at 8:45

1 Answer 1


Could you apply these business rules in the Content By Search webpart? I mean that you can configure the query to do something like: (Department:HHRR AND Fax:454*) and something like that. Depending on the complex of your business rules, you could do something like that. If not, you can "hide" the results in the Display template, where you can get all the user profile properties that you want to check, and apply your rules.

Last option could be use the Search REST API and see if you can run a query with all your needed rules.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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