Microsoft Teams (beta) API: Looks like you may not

2020-06-20 08:24发布

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?

2条回答
Ridiculous、
2楼-- · 2020-06-20 08:40

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

查看更多
别忘想泡老子
3楼-- · 2020-06-20 08:49

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.

查看更多
登录 后发表回答