Write requests are only supported on contained entities, Microsoft Graph API

こ雲淡風輕ζ 提交于 2020-06-28 02:37:41

问题


POST https://graph.microsoft.com/v1.0/Groups/bb754bb6-xxxx-xxxx-8e66-4c57c626ee29/members

Accept: application/json
Authorization: Bearer <access key>

Content:
{
  "directoryObject": {
    "id": "5cb55683-xxxx-xxxx-xxxx-5e163c939005"
  }
}

Response:

{
  error: {
    code: "BadRequest"
    message: "Write requests are only supported on contained entities"
    innerError: {
      request-id: "20167459-5495-4034-9e27-503c64340c1f"
      date: "2015-11-27T14:25:20"
    }-
  }-
}

I am able to get members of a group but not able add a member to it, any suggestion would be appreciated.


回答1:


Here is the request to add members to a group:

POST https://graph.microsoft.com/v1.0/groups/876af760-a8cd-49f0-b22c-bcb872ee97a6/members/$ref 
Authorization: Bearer <token>
Content-Type: application/json

Body:
{"@odata.id":"https://graph.microsoft.com/v1.0/users/231048d2-2761-4347-b978-07354283363b"}


来源:https://stackoverflow.com/questions/33959752/write-requests-are-only-supported-on-contained-entities-microsoft-graph-api

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