Hello @Shahab Matapour
The birthday property is not a standard property of the User resource in the Microsoft Graph API. It's also not a custom property that can be added to the SharePoint User Profile Service and then retrieved via the Graph API.
One option to achieve this is to store the birthday as a custom extension property on the Azure Active Directory (AAD) user object, and then retrieve it using the Graph API. Here are the steps to do this:
-
- Use the Azure AD PowerShell module to create a custom extension property on the AAD user object:
Connect-AzureAD
$extensionName = "birthday"
$extension = New-AzureADUserExtension -Name $extensionName -DataType DateTime
- Use the Graph API to set the custom extension property on a user:
PATCH https://graph.microsoft.com/v1.0/users/{user-id}
{
"extensions": [
{
"@odata.type": "#microsoft.graph.openTypeExtension",
"extensionName": "birthday",
"birthday": {
"dateTime": "2000-01-01T00:00:00Z",
"timeZone": "UTC"
}
}
]
}
- Use the Graph API to retrieve the custom extension property on a user:
GET https://graph.microsoft.com/v1.0/users/{user-id}?$select=displayName,mail,id,jobTitle,extensions
Note that, you will need to have the appropriate permissions to create, update and read the custom extension property on the AAD user object. You may also need to wait for a full user profile sync to happen for the custom property to be indexed properly.
Another option is to store the information in another service like Sharepoint or OneNote and then access it via the Graph API.
I hope this helps.
Please "Accept the answer" if the information helped you. This will help us and others in the community as well.