如何在显示模板中获取当前用户的托管属性 [英] How to get managed properties of current user inside the display template

查看:79
本文介绍了如何在显示模板中获取当前用户的托管属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

在基于SP 2013的人员搜索门户中,我需要根据当前用户的托管属性值来更新搜索结果的托管属性值.因此,如果我拥有托管财产,请说 测试,它具有两个值 abc def 那么我如何才能在显示模板中获取当前用户的 Test 属性,以便可以更新其余属性.

预先感谢


K Mohit

解决方案

嗨Mohit,

请按照以下步骤在显示模板中显示当前用户的 Test 属性.

在显示模板库的搜索文件夹内创建现有的 Item_Person.html 的副本.

< mso:ManagedPropertyMapping msdt:dt ="string"> 标记下添加您的自定义属性测试":测试"

在函数内部添加以下代码

 var customValue = ctx.CurrentItem.Test;

< h2> _#= customValue =#_</h2> 

此处的属性名称为 Test


Hi All,

In my people search portal that is built on SP 2013 I need to update a managed property value of search results based on the managed property value of the current user. So if I have a managed property say Test and it has two values abc and def then how can i get the Test property of current user inside the display template so that I can update the rest of the properties.

Thanks in advance


K Mohit

解决方案

Hi Mohit,

Please follow the below steps to show Test property of current user in display template.

Create a copy of existing Item_Person.html inside search folder of display template gallery.

under <mso:ManagedPropertyMapping msdt:dt="string"> tag add your custom property "Test":"Test"

Inside the function add the below code

var customValue = ctx.CurrentItem.Test;

<h2> _#= customValue =#_ </h2>

Here property name is Test


这篇关于如何在显示模板中获取当前用户的托管属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆