通过Graph API将成员添加到组的权限

时间:2020-03-20 16:13:36

标签: microsoft-graph-api

我正在尝试通过以下MS Graph API添加成员:https://docs.microsoft.com/en-us/graph/api/group-post-members?view=graph-rest-1.0&tabs=http,但遇到权限问题。请求返回

 "code": "Authorization_RequestDenied",
 "message": "Insufficient privileges to complete the operation."

我可以调用https://docs.microsoft.com/en-us/graph/api/group-list-members?view=graph-rest-1.0&tabs=http之类的API,而没有任何权限问题,并且具有Group.ReadWrite.All和User.ReadBasic.All权限。调用此API是否需要特殊的权限或角色?

1 个答案:

答案 0 :(得分:1)

是的,您还需要GroupMember.ReadWrite.AllDirectory.ReadWrite.All Application权限。

enter image description here

PostMan Request URL:

https://graph.microsoft.com/v1.0/groups/93d96b98-YourGroupId_3ede399/members/$ref

PostMan Request Body:

{
 "@odata.id": "https://graph.microsoft.com/v1.0/directoryObjects/b33ce735_YourUserId_15337c469076"
}

Postman Test:

enter image description here

Added On Group: enter image description here

注意:确保添加权限后,您已接受授权管理员的同意。

请参阅Official Document