无法通过Graph API将邀请对象添加到团队中 [英] Cannot add guests to a team through Graph API

本文介绍了无法通过Graph API将邀请对象添加到团队中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将用户添加到使用应用程序权限通过Graph API创建的团队中,但是遇到了问题.

我将以下对象发布到

I am trying to add users to a team that I have created through the Graph API using application permissions, but I run into an issue.

I POST the following object to https://graph.microsoft.com/beta/teams/{teamid}/members:

{"roles":[],"@odata.type":"#microsoft.graph.aadUserConversationMember","user@odata.bind":"https://graph.microsoft.com/beta/users/60d7e7a4-b1f6-4a5a-a9a3-80480156cb31"}

which returns 403 error code for guest users, regardless of if they are pending acceptance or has accepted the invitation. I get the following object returned:

{ "error": { "code": "Forbidden", "message": "An unknown error has occurred.", "innerError": { "date": "2020-12-17T12:10:54", "request-id": "16b3d4d7-6295-4cbd-b1bb-3803678947a6", "client-request-id": "16b3d4d7-6295-4cbd-b1bb-3803678947a6" } } }

It would seem like I might be missing some sort of permission, but I currently have these permission: Group.ReadWrite.All- Application

OnlineMeetings.ReadWrite.All - Application

TeamMember.ReadWrite.All - Application

User.Invite.All - Application

User.Read.All - Application

I have no issue when adding a member of the organisation to the team, it works perfectly fine.

Does anyone have any idea what could be wrong?

解决方案

The first thing you need to know is that you must be a global administrator or a team administrator and team owner to add guests to the team, so you must log in as a user with the role of administrator before you can add guest users.

So you can't use the application permission to get the token, because it has no user login, you can use it to add member users, but it cannot be used to add guests. You need to add TeamMember.ReadWrite.All delegates permissions, and then grants admin consent, and then you need to use auth code flow to obtain an access token.

这篇关于无法通过Graph API将邀请对象添加到团队中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆