Microsoft Graph - Create Teams API 返回“不支持包含导航属性的绑定请求". [英] Microsoft Graph - Create Teams API Returns "Bind requests not supported for containment navigation property ."

查看:80
本文介绍了Microsoft Graph - Create Teams API 返回“不支持包含导航属性的绑定请求".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Microsoft Teams 的新手,我正在尝试使用以下 API 创建一个团队

https://graph.microsoft.com/beta/teams

我正在使用以下 Python 代码片段来创建团队.

url = https://graph.microsoft.com/beta/teams"headers = {'Authorization': 'Bearer' + token, 'Content-Type': 'application/json'}数据 = {template@odata.bind":https://graph.microsoft.com/beta/teamsTemplates('standard')",显示名称":第一队",描述":第一队",members@odata.bind":[{@odata.type":#microsoft.graph.aadUserConversationMember",角色":[所有者]",用户 ID":3c0d3719-6c92-4646-af05-f02df80242db"}]}response = requests.post(url, headers=headers, data=json.dumps(data))

我收到以下回复.

b'{\r\n "error": {\r\n "code": "BadRequest",\r\n "message": "Bind requests not supported for containment导航属性.",\r\n innerError": {\r\n date": 2020-10-12T16:58:45",\r\n request-id": ";2063aba7-43f2-4024-912c-e7402bb1d6ba",\r\n 客户端请求 ID":2063aba7-43f2-4024-912c-e7402bb1d6ba"\r\n }\nn}'

我想知道我做错了什么,我试图了解有关错误消息的更多信息包含导航属性不支持绑定请求,但找不到任何有用的信息.>

有人可以帮助我理解错误的含义吗?如果可能的话,请求本身有什么问题?

解决方案

我找到了答案,我不得不修改data如下.

data = {template@odata.bind":rhttps://graph.microsoft.com/beta/teamsTemplates('standard')",显示名称":第一队",描述":第一队",成员":[{@odata.type":#microsoft.graph.aadUserConversationMember",角色":[所有者"],用户 ID":3b0d3719-6c92-4646-af05-f02df80242db"}]}

如果你不知道密钥必须是 members这是通过反复试验发现的,虽然我不确定为什么.

I'm new to Microsoft Teams, I'm trying to create a team using the following API

https://graph.microsoft.com/beta/teams

I'm using the following snippet of Python code to create the team.

url = "https://graph.microsoft.com/beta/teams"
headers = {'Authorization': 'Bearer ' + token, 'Content-Type': 'application/json'}
data = {
  "template@odata.bind": "https://graph.microsoft.com/beta/teamsTemplates('standard')",
  "displayName": "FIRST TEAM",
  "description": "FIRST TEAM",
  "members@odata.bind": [
            {
            "@odata.type": "#microsoft.graph.aadUserConversationMember",
            "roles": '[owner]',
            "userId": "3c0d3719-6c92-4646-af05-f02df80242db"
        }
  ]
}
response = requests.post(url, headers=headers, data=json.dumps(data))

I receive the following response.

b'{\r\n "error": {\r\n "code": "BadRequest",\r\n "message": "Bind requests not supported for containment navigation property.",\r\n "innerError": {\r\n "date": "2020-10-12T16:58:45",\r\n "request-id": "2063aba7-43f2-4024-912c-e7402bb1d6ba",\r\n "client-request-id": "2063aba7-43f2-4024-912c-e7402bb1d6ba"\r\n }\r\n }\r\n}'

I'd like to know what I'm doing wrong, I tried to learn more about the error message Bind requests not supported for containment navigation property but couldn't find anything helpful.

Can someone please help me understand what the error means and if possible what is wrong with the request itself ?

解决方案

I found the answer, I had to modify data as follows.

data = {
  "template@odata.bind": r"https://graph.microsoft.com/beta/teamsTemplates('standard')",
  "displayName": "FIRST TEAM",
  "description": "FIRST TEAM",
  "members": [
            {
            "@odata.type": "#microsoft.graph.aadUserConversationMember",
            "roles": ["owner"],
            "userId": "3b0d3719-6c92-4646-af05-f02df80242db"
        }
  ]
}

If you can't tell the key has to be members This was discovered through trial and error though I'm not sure why.

这篇关于Microsoft Graph - Create Teams API 返回“不支持包含导航属性的绑定请求".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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