1

I've been doing some investigating and apparently a user's birthday date (the one that shows up on Delve) is not stored in a property inside the user's own office365 account object.

I'm trying to create a PowerShell script in Azure where I can update a user's birthday with a value that is currently in a SharePoint list. As of right now if I could find out how to even set the birthday property hard-coded, that would be some progress.

Get-MsolUser and Set-Msoluser don't work because as I stated previously the birthday date isn't there for some reason, but I can retrieve a user's birthday utilizing Microsoft Graph and sending a GET request to this URL of the API https://graph.microsoft.com/v1.0/users/{user_id}/birthday.

The response of that request is what I would like to be able to automatically set, but I can't seem to find a way to do so.

4
  • I believe I found the answer to my question here: docs.microsoft.com/en-us/graph/api/… will update if it works
    – Ress
    Jan 14 at 15:49
  • Did you try this? Do you want to perform this using PowerShell or Microsoft Graph? Jan 14 at 15:56
  • I saw that but didn't follow through because I didn't think that Delve and SP user details would be connected, I was only looking for office365 user properties.
    – Ress
    Jan 14 at 16:10
  • And I want to perform it with powershell, but if cmdlet didn't exist I was considering creating a script to invoke a rest method and patch the birthday dates that way
    – Ress
    Jan 14 at 16:12
1

You can set the birth date using Set-PnPUserProfileProperty in PnP PowerShell.

For Example:

Set-PnPUserProfileProperty -Account 'user@tenant.onmicrosoft.com' -PropertyName "SPS-Birthday" -Value "01/14/2020"

Output:

enter image description here


Update from comments:

I tried running the graph query https://graph.microsoft.com/v1.0/users/{user_id}/birthday. This also returns the same birth date:

enter image description here

Update Birth date using Microsoft Graph:

Method: PATCH

Endpoint:

https://graph.microsoft.com/v1.0/users/{user_id}

Request body:

{
    "birthday":"2014-01-01T00:00:00Z"
}

enter image description here

7
  • Would this update the Delve "birthday" property as well?
    – Ress
    Jan 14 at 16:09
  • Yes it will. Check the command I used and the output in updated answer. Jan 14 at 16:21
  • This sets the value to the UPSA which isn't a Graph query, what the OP was asking about. UPSA will be going away so I'd suggest the Graph route.
    – Trevor Seward
    Jan 14 at 16:22
  • This is one-time thing that I need to run in order to update our employees' birthday dates @TrevorSeward, do you recon the graph approach is better? One problem I found is that my account doesn't have access to change other people's properties. Is there a workaround for that?
    – Ress
    Jan 14 at 16:30
  • I tried running the graph query https://graph.microsoft.com/v1.0/users/{user_id}/birthday. This also returns the same birth date as I set using PnP PowerShell. see updated answer. To update the user profile properties of other users, you will need administrator permissions. Jan 14 at 16:34
1

It finally worked. Here's the code to change one single user's birthday date (...where $creds name is the name of a credential created on the azure automation account used to run the script, with full sharepoint admin privileges given on the admin site (the same site used as url)):

Connect-PnPOnline -Url https://xxxx-admin.sharepoint.com/ -Credentials $creds

Set-PnPUserProfileProperty -Account 'xx.xxxx@xxx.com' -PropertyName "SPS-Birthday" -Value "01/14/2020"```

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.