03-23-2018 08:40 PM - edited 03-28-2018 07:17 PM
03-23-2018 08:40 PM - edited 03-28-2018 07:17 PM
Recently, I’ve been asked if there was a simple way to provide birthday reminders on a SharePoint intranet without any customizations. Well, after looking at some of the options available in SharePoint Modern sites, it’s possible (with the help from Delve and Microsoft Flow).
In this article, I demonstrate how to showcase the names of people who have a birthday today. I have not included the year or age as most of us don’t age beyond 25 anyways. One thing that I really like about this approach is that the birth date is set in Delve and give each user the choice whether to share it with others or not. If not, then their name will not appear on the SharePoint site. Other items that this solution can be extended to is to use the hire date and highlight specific anniversary milestones.
Setting the Birthday in Delve
As I’ve mentioned above, one of the first steps was to set the birthdays in Delve. To set your birthday, click the Update profile button when you first visit your profile page. This will take you to a page that looks like the one below. Each user can do this themselves.
What is important is that the icon on the right should show a globe to indicate that everyone can see the birthday. If it’s set to a lock, then only the user themselves can see it.
That’s all you need to do in order for your birthday to show up in SharePoint. You can also use the employee's Hire Date to display work anniversaries. To edit a user's hire date,
Scroll down and select a date for Hire Date. Make sure that Everyone is selected in the drop-down beside the date.
NB: Now that you know my birthday, I expect at least a birthday card or like on this article on that day :smiling_face_with_smiling_eyes:
Creating the Celebrations web part in SharePoint and List
As I decided to go with a no-code solution, I had to stick with one of the out of the box web parts that would provide a decent look. So, I actually chose an events list. I created a new list called Celebrations, which is an out of the box Calendar list and linked it to the Events web part as shown on the right side of the page.
The flow ensures that only users who have entered their birthdays and have a birthday on a specific day show up in the list that day. I also uploaded an image called confetti.png onto my site to be used as a banner image for the events.
Building the Flow
The flow is somewhat straight forward and is broken down into three parts
The Flow begins with a trigger being set to kick-off the flow each day at midnight. Make sure to set your time zone, otherwise you may have birthdays start and end time wrapping a calendar day.
Nothing fancy here. Just a loop that iterates through the Celebrations list and deletes all the items found
This is where the good stuff happens. The action starts by searching all Office 365 users that match a given term by display name, given name, surname, mail, mail nickname or user principal name. To keep it simple, I’ve included the search term com, which appears in everyone’s email.
Next, I use a comparison between today's date and a date that is available in the user's profile. As I've mentioned earlier, I have the user's birthday and hire date that I can set and to no surprise, the same fields are available as dynamic content from the Get user profile (V2) action.
In this article, I check to see if the birth day and month are today and that the birth year is not 0001, which indicates that the user didn’t provide a birthday in their Delve profile. To do so, I’ve used the following expression
@and(equals(substring(body('Get_user_profile_(V2)')?['birthday'], 5, 5) , substring(utcnow(),5,5)), not(equals(int(substring(body('Get_user_profile_(V2)')?['birthday'],0,4)), 0001)))
And finally, I add an item for each match into the Celebrations list. For the Start Time and End Time, I set them to go from midnight until just before midnight the next day
Remember the confetti.jpg image I uploaded into the document library? You can see it being referenced in the Banner URL field. This image appears at the top of each celebration event created.
With the modern Events web part, when there are no celebrations on a day, it shows the three default events, which is not ideal. I’d rather the entire webs part be hidden in that case. As well, the Flow action does not allow to specify full-day events, requiring you to enter a start and end time.
03-26-2018 06:33 AM
Maybe that would deserve a proper blog article... anyway thanks for sharing. I tried already to use this web part before but I found out that it was not ideal.
So far my not much code solution was to use search web part with some custom query and template, but that's for classic SharePoint.
Maybe at some point I will code the SPFx web part, as I think I already have the search API query somewhere to retrieve the users with upcoming birthday. However using Flow to put the result in a list once a day might be better in term of performance, instead of having the search query against all users happening every time a user goes to the intranet page.
03-28-2018 06:42 PM
Thanks for the feedback, @Aim Zaab. Where would you like to see a full blog article posted on this topic? Happy to add it.
03-30-2018 07:36 AM
06-14-2018 11:16 AM
This looks like a great idea, and I'm very hopeful I can use it. However, the Search for Users action is not performing as your article suggests. You use "com" as the search term assuming it will return all users since all users have .com in their e-mail address.
This is not working for me. Using com as the search term only returns 26 users instead of the expected ~5000. It appears the domain part of the mail or user principal name is not being used in the search.
Do yo have another way to return all users?
08-18-2018 08:32 PM
Hi @Ronald Rohlfs, I haven't come across this issue as my tenant doesn't have that many users. Did anyone else experience this limitation?
02-01-2019 06:08 AM
I like this non-coded way of showing Birthdays on a SP site but I have an issue. In the part when Get user profile (V2) comes in, I can't find Birthday inside "Dynamic Content". Are you familiar with this?
02-25-2019 10:30 AM
I'm having trouble get a list of all the users. I've used the "org" criteria similar to your "com" but it looks like they've changed the behavior. I think they are screening out the last part of the email address and looking for things before the @ sign. Any ideas?