Wednesday, November 29, 2017

Retrieving Teams and Yammer endpoints for an Office 365 Group via the Microsoft Graph

image

I’m working on a solution listing all things Groups from Office 365. That be Office 365 Groups with Outlook, Office 365 Groups with Yammer, Office 365 Groups with Teams, or just plain old Yammer Groups standing by themselves. The last one you cannot do via the Graph so let’s just skip that one for now.

I recently wrote about how you can list all O365 Groups which have a Yammer association, but I did not cover how to get the link to Yammer – as I had no clue how. I have now clued myself in, and will share my findings.

Once again I have been digging around the /beta endpoint for the Microsoft Graph, and at the groups endpoint for a specific group you can append the resource /endpoints.

GET https://graph.microsoft.com/beta/groups/b5c6e927-6f6d-4609-aede-28580e485757/endpoints

If the Group has a Yammer association the returned data looks like this:

{
    "@odata.context": "https://graph.microsoft.com/beta/$metadata#groups('b5c6e927-6f6d-4609-aede-28580e485757')/endpoints",
    "value": [
        {
            "id": "5ba80c0d-929c-44c4-8e8e-e76c28356a99",
            "deletedDateTime": null,
            "capability": "Conversations",
            "providerId": "00000005-0000-0ff1-ce00-000000000000",
            "providerName": "Yammer",
            "uri": "https://www.yammer.com/contoso.com/#/threads/inGroup?type=in_group&feedId=4500601",
            "providerResourceId": "Yammer.FeedURL"
        }
    ]
}

For a Team association it looks like this:

{
    "@odata.context": "https://graph.microsoft.com/beta/$metadata#groups('60effc7a-dce5-4289-8f7c-46be8e259f01')/endpoints",
    "value": [
        {
            "id": "f00cab90-db10-4939-bc96-423b93869d7e",
            "deletedDateTime": null,
            "capability": "Team Collaboration",
            "providerId": "903cef4f-710e-4cc1-989a-bfdc6ab01812",
            "providerName": "Microsoft Teams",
            "uri": "https://teams.microsoft.com/l/team/19:5a8ce0ec568643b7a6433c76fff9a210%40thread.skype/conversations?tenantId=acb88c10-67b8-48cc-8819-85de37e8af92",
            "providerResourceId": "MicrosoftTeams.TeamHomeURL"
        }
    ]
}

The endpoint is not documented and does not (yet?) work in a listing scenario, but for a single group you can call it.

I tried some PUT operations on the endpoints endpoint, but seems you cannot add your own arbitrary endpoints now. It’s also not possible to do a select or expand on the endpoints resource, so you end up with at least two calls if you first need to get the Group, then get the extra information.

My thinking right now is to replicate this information and store it using schema extensibility, making it available on listing calls – reducing the number of Graph calls.

Either way, if you need Yammer/Teams information you can at least get them using this one call.