用于在SharePoint PnP搜索中获取用户名的用户把手表达式

用于在SharePoint PnP搜索中获取用户名的用户把手表达式,sharepoint,handlebars.js,Sharepoint,Handlebars.js,我正在SharePoint online中使用PnP搜索。我正在创建搜索结果web部件,并尝试为用户名添加列。此列中返回的字符串如下所示: Kate.Smith@contoso.com | Smith, Kate | 693A30232E...7175 i:0#.f|membership|Kate.Smith@contoso.com 我只需要抓取用户名“Smith,Kate”即可显示。 但我在网上找不到任何指南。请尝试使用此链接 管理人物角色字段 管理角色字段配置页面 只保留{{First

我正在SharePoint online中使用PnP搜索。我正在创建搜索结果web部件,并尝试为用户名添加列。此列中返回的字符串如下所示:

Kate.Smith@contoso.com | Smith, Kate | 693A30232E...7175
i:0#.f|membership|Kate.Smith@contoso.com
我只需要抓取用户名“Smith,Kate”即可显示。 但我在网上找不到任何指南。

请尝试使用此链接

  • 管理人物角色字段

  • 管理角色字段配置页面

  • 只保留
    {{FirstName}}{{LastName}}


  • 看看这个答案,首先你必须用“|”分开,因为我们有内置的把手,你可以在布局中使用

    按“|”拆分:
    {{Split item.userField”|“}}

    拆分句柄栏文档:

    在分割之后,你必须取中间的一个,所以给出它的索引

    要获取索引值,请执行以下操作:

    {{itemAt (split item.userField "|") 1}}`
    {{itemAt (split "Kate.Smith@contoso.com | Smith, Kate | 693A30232E...7175" "|") 1}}
    
    关于项目的文件: