Quantcast
Channel: blog.atwork.at
Viewing all articles
Browse latest Browse all 1118

Generate the Manage team URL from code

0
0

Sometimes it makes sense to provide users with a link to manage a Microsoft Team in applications or in generated emails. However, only the Teams client can do this. Or?

The teams client offers the Manage team option

The teams client allows open the options menu, and to click on the Manage team menu.

2023-09-19 10_28_09-(2) _ Microsoft Teams and 2 more pages - toni@tpe5 - Microsoft​ Edge

In the Members page, the team owners can control the users and guests. This is useful functionality for the owners to view and to manage access to their team.

image

Why not use that built-in functionality from our own apps

In the Teams client in the browser, the URL looks similar as here:

https://teams.microsoft.com/_#/teamDashboard/Governance/19:6da66e9851ab44f7b516ae01695f00af@thread.tacv2/td.members

Unfortunately, this URL cannot be generated with the team Name and the team Id. The Id used in this URL seems to be a different one.

Graph as solution

It took me some time and trying to figure out how to create this Manage Team URL myself. So, here's how you can construct the "Manage team" URL for my own flows and applications. The solution lies in using the Microsoft Graph API.

Graph Explorer helps you try things out. First, we can search for the team, as here:

https://graph.microsoft.com/v1.0/groups?$filter=startswith(displayName,'Governance')

This delivers the team Id.

{ ...
    "value": [
        {
            "id": "74bebe7a-28c0-46c8-af45-c53ba856e89d",
            "displayName": "Governance", ...
       }
    ]
}   

Now we can ask for the InternalId as follows.

https://graph.microsoft.com/v1.0/groups/74bebe7a-28c0-46c8-af45-c53ba856e89d/team?$select=internalId

And voila – we get the required Id.

{
"@odata.context": https://graph.microsoft.com/v1.0/$metadata#teams(internalId)/$entity,
"internalId": "19:6da66e9851ab44f7b516ae01695f00af@thread.tacv2"
}

The following screenshot shows this request in Graph Explorer.

image

Now, with the team Name, and the internalId, we can construct the URL as here.

https://teams.microsoft.com/_#/teamDashboard/<displayName>/<internalId>/td.members

If the team Name includes spaces or other special chars, the URL should be urlencoded, as in the sample here.

https://teams.microsoft.com/_#/teamDashboard/Team%20Las%20Vegas/19:79p…@thread.tacv2/td.members

We can use this generated link in our apps to to manage a Microsoft Team.

Graph helped!


Viewing all articles
Browse latest Browse all 1118

Latest Images

Trending Articles