与所有者一起在Microsoft Graph API中创建组 [英] Create a Group in Microsoft Graph API with a Owner

查看:76
本文介绍了与所有者一起在Microsoft Graph API中创建组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个想通过Microsoft Graph API添加的Office 365组.根据API文档,我相信我需要

I have a Office 365 Group that I would like to add through the Microsoft Graph API. Based on the API documentation, I believe I need

POST https://graph.microsoft.com/v1.0/groups
Content-type: application/json
Content-length: 244

{
  "description": "Self help community for library",
  "displayName": "Library Assist",
  "groupTypes": [
    "Unified"
  ],
  "mailEnabled": true,
  "mailNickname": "library",
  "securityEnabled": false
}

但是当我尝试添加

"owner": [{ "@odata.id": "https://graph.microsoft.com/v1.0/users/{id}"}]

我收到一个错误消息(该ID实际上是办公室中存在的一个ID,因此我不想将其放在此处).

I get an error (The id is really an id that exists in the office so I don't want to put it here).

如果我先运行创建组,然后再运行添加所有者,但不能一起运行,它们将起作用.为什么?

They work if I first run the create group and then the add owner but not together. Why?

想让它对我来说尽可能的容易.我将邮递员放在标签中只是因为这是我当前正在使用的工具

Would like to make it as easy for me as possible. I'm putting postman in the tags just because that's the tools I'm currently using

推荐答案

实际上,现在可以使用OData绑定语法(即您的语法不正确)对此进行支持.注意:这是我们的错,不是您的错,因为我们没有记录此受支持的行为.我会在我们这一边提交一个错误来对此进行记录.

Actually this is supported and possible today using OData bind syntax (i.e. your syntax is incorrect). NOTE: This is our bad, not your, because we haven't documented this supported behavior. I'll file a bug on our side to document this.

同时,尝试将其添加到您的请求中(对我有用),并告诉我们是否对您有用:

In the meantime, try adding this to your request (it worked for me), and let us know if this works for you:

"owners@odata.bind": ["https://graph.microsoft.com/v1.0/users/{id}"]

实际上,在同一请求中,您还可以将成员绑定为请求的一部分:

In fact, in the same request you can also bind members as part of the request:

"owners@odata.bind": [ "https://graph.microsoft.com/v1.0/users/{id1}" ], "members@odata.bind": [ "https://graph.microsoft.com/v1.0/users/{id1}", "https://graph.microsoft.com/v1.0/users/{id2}" ]

"owners@odata.bind": [ "https://graph.microsoft.com/v1.0/users/{id1}" ], "members@odata.bind": [ "https://graph.microsoft.com/v1.0/users/{id1}", "https://graph.microsoft.com/v1.0/users/{id2}" ]

不确定可以在绑定集合中放置的项目数有什么限制,但是我确定有一个限制.我看看其中一位开发者是否可以对此发表评论.

Not sure what the limits are on the number of items you can put in the binding collection, but I'm sure there is one. I'll see if one of the devs can comment on this.

希望这会有所帮助,

这篇关于与所有者一起在Microsoft Graph API中创建组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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