Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Display a list of upcoming birthdays of Office 365 users using Microsoft Graph API

Tags:

Using the Microsoft Graph API, I want to create a list of all Office 365 users's birtdays, but I cannot get the list of users with the related properties at the moment.

To set up this list I need the following properties exposed via the Graph API:

  • id
  • displayName
  • userPrincipalName
  • birthday

Using the Graph Explorer, https://graph.microsoft.io/en-us/graph-explorer, I've tried to request my own properties (graph.microsoft.com/v1.0/Me/?$select=id,displayName,userPrincipalName,birthday) which works:

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users(id,displayName,userPrincipalName,birthday)/$entity",
    "id": "aaaaaaaa-bbbbb-ccccc-a3c6-63817c4bbbca",
    "displayName": "Harold van de Kamp",
    "userPrincipalName": "[email protected]",
    "birthday": "2000-08-15T00:00:00Z"
}

When I query all users (graph.microsoft.com/v1.0/Users), that also works, but doens't contain all the required properties

But when I query all users with the required properties (graph.microsoft.com/v1.0/Users/?$select=id,displayName,userPrincipalName,birthday), I get the following error:

{
    "error": {
        "code": "InternalServerError",
        "message": "This operation is not yet supported.",
        "innerError": {
            "request-id": "06a7b9c9-2fcd-4f26-a86c-fe9704a35a1e",
            "date": "2016-06-11T11:15:45"
        }
    }
}

Querying the beta API (graph.microsoft.com/beta/Users/?$select=id,displayName,userPrincipalName,birthday) results in the same error.

Question: Any idea why I get this error and how can we get this working?

Bonus question: Is it possible to directly query only a list of upcoming 15 birthdays?

like image 481
Harold Van de Kamp Avatar asked Jun 11 '16 11:06

Harold Van de Kamp


2 Answers

Sorry Harold, but unfortunately as the error message says, this is not currently supported. Behind the scenes Microsoft Graph is farming out requests for data to multiple services. While Microsoft Graph does support paging within services, it doesn't yet support paging (or expand) across services. This is something that we will be working on, but no ETA yet I'm afraid.

like image 193
Dan Kershaw - MSFT Avatar answered Sep 28 '22 02:09

Dan Kershaw - MSFT


workaround could be to access that property separately: https://graph.microsoft.com/v1.0/users/<id_or_principle_name>/birthday

like image 44
wivku Avatar answered Sep 28 '22 03:09

wivku