Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Microsoft Teams (beta) API: Looks like you may not have the permissions for this call. Please modify your permissions

I used the Graph Explorer to test against my Office 365 profile. Everything works fine accept the Microsoft Teams (beta) API. If I use GET https://graph.microsoft.com/beta/me/joinedTeams I get

Status Code 401 - Looks like you may not have the permissions for this call. Please modify your permissions.

{
    "error": {
        "code": "",
        "message": "Authorization has been denied for this request.",
        "innerError": {
            "request-id": "a1733d8a-5adb-45ad-a0ad-463595d71a89",
            "date": "2017-06-09T14:33:11"
        }
    }
}

There seems no option for give permission for Microsoft Teams. Has anyone figured that out, yet?

like image 274
Daniel Göhler Avatar asked Jun 09 '17 14:06

Daniel Göhler


People also ask

How do I add API permissions in Azure?

Select Azure Active Directory > App registrations, and then select your client application. Select API permissions > Add a permission > Microsoft Graph > Application permissions.

Is there a Microsoft teams API?

You can create websites, services, and native platform applications that run outside the Microsoft Teams user experience, and call the Teams API to automate Teams scenarios.

How do I grant access to graph explorer?

You can consent to permissions in Graph Explorer by choosing either the Modify permissions tab or the Consent to permissions option under the profile avatar when you're signed in.


2 Answers

The documentation page for listing your joined teams is at https://developer.microsoft.com/en-us/graph/docs/api-reference/beta/api/user_list_joinedteams. It looks like this call requires the User.Read.All or User.ReadWrite.All permissions. To change your permissions in the Graph explorer, you can click Modify Permissions

enter image description here

Then find and enable either permission:

enter image description here

However, these scopes require tenant administrators to let the Graph Explorer use admin only scopes. You can either just login as an administrator to just test with that account, or you can let any user in your organization access admin scopes through the explorer by clicking the link that says grant access to your entire organization.

enter image description here

Also, I'm glad you found the Microsoft Teams samples. We just added these last week and it's great to see developers are trying them out! Thanks for your feedback on the permissions process for the Teams in explorer, I'll pass that along to all the engineers on the project.

like image 53
David Avatar answered Oct 17 '22 03:10

David


I've created a command line tool that lets you bulk create new Microsoft Team channels using the Graph APIs outlined above. It includes instructions on how to register your application for use with your Teams environment - and provide administrative consent so that non-admins can use it.

One of the API calls is to "joinedTeams", which lists the Teams you're currently a member of. Take a look in "SelectJoinedTeam" function in the ChannelSurfCli/Utils/Channels.cs class.

https://github.com/tamhinsf/ChannelSurf

like image 28
Tam Huynh Avatar answered Oct 17 '22 03:10

Tam Huynh