通过 Power Automate 创建专用频道 JSON and/or 图表 API 有什么问题?

What's wrong with the Create Private Channel JSON and/or Graph API via Power Automate?

我正在创建一个流程来为 Teams 提供特定的结构和模板,但是当我开始创建私人频道时,无法正确完成。我总是尝试使用图形资源管理器做同样的事情,但是当我将 json 主体粘贴到 power automate 中时,会显示所有类型的错误。

这是在 Graph Explorer 中运行的代码

POST https://graph.microsoft.com/beta/teams/{group_id}/channels
Content-type: application/json

{ "membershipType": "Private",
  "displayName": "Confidential info",
  "members":[{    
           "@odata.type":"#microsoft.graph.aadUserConversationMember",
           "user@odata.bind":"https://graph.microsoft.com/beta/users('<userID>')",
           "roles":["owner"]
            }]
}

这是根据文档的请求正文:

POST https://graph.microsoft.com/beta/teams/{group_id}/channels
Content-type: application/json

{
  "@odata.type": "#Microsoft.Teams.Core.channel",
  "membershipType": "private",
  "displayName": "My First Private Channel",
  "description": "This is my first private channels",
  "members":
     [
        {
           "@odata.type":"#microsoft.graph.aadUserConversationMember",
           "user@odata.bind":"https://graph.microsoft.com/beta/users('{user_id}')",
           "roles":["owner"]
        }
     ]
}

我想将这段代码添加到流程中,但是当我 运行 它出现以下错误消息时:

{
  "error": {
    "code": "BadRequest",
    "message": "channel cannot be null.\r\nParameter name: channel",
    "innerError": {
      "request-id": "<id>",
      "date": "<date>"
    }
  }
}

谢谢!

我找到了答案。如果以后有人遇到同样的问题,希望对您有所帮助。

“@odata.type”和“@odata.bind”必须初始化为字符串变量否则http请求会报错