3

I have updated an user profile Birthday date using Powershell Birthday format(MMM DD) Eg: February 15. here is my script

 $adAccount = "domain\username"
 $up = $profileManager.GetUserProfile($adAccount)
 $up["SPS-Birthday"].Value = "February 15"
 $up.Commit()

Now I have run the Incremental call in search service application. after that I browse the search api to retrieve the results whose Birthday from "February 05" to "February 20"

see url below

/_api/search/query?querytext='Birthday>="02-05-2000" AND Birthday<="02-20-2000"'&sourceid='b09a7990-05ea-4af9-81ef-edfab16c4e31'&selectproperties='AccountName,FirstName,Birthday'

I am unable to retrieve the profile which I was updated through powershell shown above in search api results.

Please provide me solution for this...!

2 Answers 2

2

Try with below powershell:

$adAccount = "domain\username"
$up = $profileManager.GetUserProfile($adAccount)

$birthday = "February 15"
$birthdayDateValue = "{0:dd MMM}" -f [datetime]$birthday
$up["SPS-Birthday"].Value = $birthdayDateValue

$up.Commit()

Check if the value is updated in the user's profile via Central admin.

Map the SPS-BirthDay property to one of the RefinableDate00 property as below (sorry for non-english screenshot) :

enter image description here

After that do a full crawl of the People content source.

Now modify your REST query as below:

/_api/search/query?querytext='*'&sourceid='b09a7990-05ea-4af9-81ef-edfab16c4e31'&selectproperties='AccountName,FirstName,RefinableDate00'&refinementfilters='RefinableDate00:range(datetime(02-05-2000), datetime(02-20-2000), from=\"ge\", to=\"le\")'"

Reference - Limit search results by exact time SP 2013

show upcoming birthdays based on sharepoint 2013 user profiles

5
  • Still the problem exists on search results I cannot see the profile which I updated through Powershell. Commented Feb 16, 2017 at 7:24
  • is the property correctly updated via powershell ? did you check it via central admin ? Commented Feb 16, 2017 at 7:59
  • can you check the edited answer ? also can you check if the property is actually updated in the user profile via central admin ? Commented Feb 16, 2017 at 11:39
  • Yes i have checked in central admin it is showing updated Birthday which I did through powershell. Commented Feb 17, 2017 at 4:51
  • I am not able to get results when I tried your rest API response in SharePoint Online. Is there any changes in endpoint over the time? Commented Mar 7, 2020 at 13:04
0

Map the SPS-Birthday crawled property with one of the managed property and while searching, use Managed property name instead of Birthday.

refer the screen shot - i have mapped the SPS-Birthday property with RefinableString00

enter image description here

7
  • I tried this but it is not working when i use search api giving exception that we didn't understand you search term /_api/search/query?querytext='RefinableString00>="02-05-2000" AND RefinableString00<="02-20-2000"'&sourceid='b09a7990-05ea-4af9-81ef-edfab16c4e31'&selectproperties='AccountName,FirstName,Birthday' Commented Feb 16, 2017 at 5:17
  • Try like that into your people search center - RefinableString00:"MM/dd" by default year is considered as 2000. in your search query also you have to build your string like this Commented Feb 16, 2017 at 5:20
  • Also make sure the User Profile property SPS-Birthday visibility set to everyone, if it is only me then search wont return any result.. Commented Feb 16, 2017 at 5:26
  • I am allowed to search data and fetch all the profiles correctly, if I update the Birthday with "MM/DD/YYYY". If I update like "February 15" with out year I am unable to get it. Commented Feb 16, 2017 at 7:26
  • I am able to get the data the problem is when update only month and day it is taking by default current year not 2000 that why in my search query filter i am unable to see the data which is in 2000 year. If i keep current year i am able to search results. Thanks for you response..! Commented Feb 21, 2017 at 11:33

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.