如何从搜索查询中获取SPS-Birthday属性 [英] How to get SPS-Birthday property from Search query
问题描述
我正在尝试在SPFx中获取用户的生日.我采用了以下方法:
- 从共享点站点的用户信息列表中获取用户
- 获取电子邮件,然后使用GetPropertiesFor方法获取用户属性
我正在获得结果,但是延迟了所有用户的循环.现在我只有30个用户.但是,如果有1万名用户,则webpart将永远挂起.因此,我决定通过搜索查询来获取详细信息.为此,我正在使用下面的查询
this.context.pageContext.web.absoluteUrl +`/_api/search/query?querytext ='*'& sourceid ='B09A7990-05EA-4AF9-81EF-EDFAB16C4E31'& selectproperties =' PreferredName,WorkEmail,PictureUrl,Title,Departament,SPS-Birthday,Url'`
但是"SPS-Birthday"属性没有任何价值.但是用我的第一种方法,"SPS-Birthday"具有价值.如何通过搜索查询实现?
Mihir
嗨Mihir,
您的REST URL不正确.
进行如下检查,您需要将属性SPS-Birthday映射到诸如RefinableDate00之类的可精炼属性.
>转到网站设置->网站集管理->搜索架构(您也可以在SharePoint Admin级别进行配置)
>搜索RefinableDate00,编辑映射
>给它起一个像Birthday01的别名
>将"People:SPS-Birthday"添加为抓取字段映射
完成后,等待抓取完成.
更多信息供您参考:
I am trying to get the birthdays of user in SPFx . I have taken below approach:
- get users from userinformation list of sharepoint site
- get the email, then get the properties of user with GetPropertiesFor method
I am getting results, but it is delaying to loop through all users. right now i am having only 30 users. But if there 10K users then webpart will hang forever. So I decided to get the details with search query. for this i am using below query
this.context.pageContext.web.absoluteUrl+`/_api/search/query?querytext='*'&sourceid='B09A7990-05EA-4AF9-81EF-EDFAB16C4E31'&selectproperties='PreferredName,WorkEmail,PictureUrl,Title,Departament,SPS-Birthday,Url'`
But `SPS-Birthday` property doesn't have any value. But with my first approach `SPS-Birthday` is having value. How to achieve through search query?
Mihir
Hi Mihir,
Your REST URL is not right.
Check as below, you need to map the property SPS-Birthday to one the Refinable properties like RefinableDate00.
> Go to the Site Settings -> Site Collection Administration -> Search Schema (you can also configure this in the SharePoint Admin level)
> Search for RefinableDate00, Edit the mapping
> Give it an alias like Birthday01
> Add "People:SPS-Birthday" as crawled field mappingOnce done, wait for the crawl to be completed.
More information for your reference:
http://www.vrdmn.com/2013/07/sharepoint-2013-get-userprofile.html
Best regards,
Lee Liu
这篇关于如何从搜索查询中获取SPS-Birthday属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!