top of page
Writer's pictureKasper Larsen

Using PnP Modern Search to display today's birthdays

In the PnP Modern Search Repository bigbear48858 asked about a separate web part for showing birthdays and work anniversaries:

















That got me thinking about how to set up a Search Result web part to display today's birthdays.


The tricky part is that in the User profile application the birthday value is store is a rather usual datatype "date no year"





In my tenant the SPS-Birthday property was mapped to RefinableDate00 and the actual value in the property is 2000-[the date]:



(I used the magnificent SP Editor tool to inspect the managed properties)


So, the query had to be something like "those accounts where RefinableDate00 = 2000 + the value of today's date


In KQL we have the token "today" that will give us today's date, but as far as I know, we can't get the components the date consist of, like Month and Day.

Luckily, the PnP Modern search provides additional Tokens, see Tokens - PnP Modern Search (v4) (microsoft-search.github.io)


So the final query is:


RefinableDate00=2000-{CurrentMonth}-{CurrentDate}T00:00:00Z

( and of cause a criteria to exclude former employees, like SPS-HideFromAddressLists<>1)



Comments


bottom of page