如何从搜索查询中获取SPS-Birthday属性 [英] How to get SPS-Birthday property from Search query

查看:62
本文介绍了如何从搜索查询中获取SPS-Birthday属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在SPFx中获取用户的生日.我采用了以下方法:

  1. 从共享点站点的用户信息列表中获取用户
  2. 获取电子邮件,然后使用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不正确.

它可能像这样: https://sitecollectionurl/_api/search/query?querytext ='*'& sourceid ='B09A7990-05EA-4AF9-81EF-EDFAB16C4E31'& rowlimit = 5& selectproperties ='PreferredName,WorkEmail,PictureUrl,Title,Department,RefinableDate00,Url '

进行如下检查,您需要将属性SPS-Birthday映射到诸如RefinableDate00之类的可精炼属性.

>转到网站设置->网站集管理->搜索架构(您也可以在SharePoint Admin级别进行配置)
>搜索RefinableDate00,编辑映射
>给它起一个像Birthday01的别名
>将"People:SPS-Birthday"添加为抓取字段映射

完成后,等待抓取完成.

更多信息供您参考:

最好的问候,

Lee Liu


I am trying to get the birthdays of user in SPFx . I have taken below approach:

  1. get users from userinformation list of sharepoint site
  2. 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.

It could like: https://sitecollectionurl/_api/search/query?querytext='*'&sourceid='B09A7990-05EA-4AF9-81EF-EDFAB16C4E31'&rowlimit=5&selectproperties='PreferredName,WorkEmail,PictureUrl,Title,Department,RefinableDate00,Url'

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 mapping

Once done, wait for the crawl to be completed.

More information for your reference:

https://sharepoint.stackexchange.com/questions/208148/failed-to-retrieve-user-profile-using-search-api-by-birthday-date-filter-after-u

https://joranmarkx.wordpress.com/2013/10/02/show-upcomming-birthdays-based-on-sharepoint-2013-user-profiles-with-search-office365/

http://www.vrdmn.com/2013/07/sharepoint-2013-get-userprofile.html

Best regards,

Lee Liu


这篇关于如何从搜索查询中获取SPS-Birthday属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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