Question

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.

Was it helpful?

Solution 2

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"```

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top