Permissions to add member to group via Graph API

别说谁变了你拦得住时间么 提交于 2020-07-03 08:07:48

问题


I am trying to add a member via this MS Graph API: https://docs.microsoft.com/en-us/graph/api/group-post-members?view=graph-rest-1.0&tabs=http but am running into permission issues. The request returns back

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

I am able to call APIs like https://docs.microsoft.com/en-us/graph/api/group-list-members?view=graph-rest-1.0&tabs=http with no permission problem, and I have Group.ReadWrite.All and User.ReadBasic.All permissions. Is there a special permission or role I need to be to call this API?


回答1:


Yes you also need GroupMember.ReadWrite.All and Directory.ReadWrite.All Application permission.

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:

Added On Group:

Note: Make sure after adding permission you have accepted grant admin consent.

Please refer to Official Document



来源:https://stackoverflow.com/questions/60777789/permissions-to-add-member-to-group-via-graph-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!