创建链接到团队频道的事件 - Microsoft Api Graph

时间:2020-12-23 16:42:21

标签: calendar microsoft-graph-api microsoft-teams

我正在尝试在日历中创建一个事件,以模拟直接在 Microsoft Teams 上创建的事件。因此,基本上当您通过 Microsoft Teams 创建活动时,您可以指定必须成为活动一部分的组和频道。
我正在使用正确的端点:https://docs.microsoft.com/en-us/graph/api/user-post-events?view=graph-rest-1.0&tabs=http.
这是我作为发布请求传递的信息:

{
    subject:"Event Subjct",
    isOrganizer: true,
    start: {
        dateTime:"2020-12-29T12:00:00",
        timeZone:"Pacific Standard Time"
    },
    end: {
        dateTime:"2020-12-29T14:00:00",
        timeZone:"Pacific Standard Time"
    },
    isAllDay: false,
    allowNewTimeProposals: true,
    isOnlineMeeting: true,
    attendees: {
        {
            emailAddress: {
                address:"<groupName@emailaddress.ext>", <-- got directly from Azure
                name:"<TeamGroupName>"
            },
            type:"required"
        }
    },
    hideAttendees: false,
    type: "singleInstance",
    transactionId: "<UNIQUE_ID>",
    onlineMeetingProvider: "teamsForBusiness"
}

注意:<..> 之间的所有值都是占位符。

活动已正确创建,但在与会者字段中指定的团队频道组中没有参考。我已经搜索了与会者数组的定义,并且没有什么特别要注意与会者集合中的组+频道:https://docs.microsoft.com/en-us/graph/api/resources/attendee?view=graph-rest-1.0

有什么帮助吗?
谢谢

1 个答案:

答案 0 :(得分:0)

您需要使用 following API call to create the event in the Groups。例如,您需要使用:

POST https://graph.microsoft.com/v1.0/groups/01d4ee64-15ce-491e-bad1-b91aa3223df4/events
Content-type: application/json

 {
  "subject": "Let's go for lunch",
  "body": {
    "contentType": "HTML",
    "content": "Does late morning work for you?"
  },
  "start": {
      "dateTime": "2019-06-16T12:00:00",
      "timeZone": "Pacific Standard Time"
  },
  "end": {
      "dateTime": "2019-06-16T14:00:00",
      "timeZone": "Pacific Standard Time"
  },
  "location":{
      "displayName":"Harry's Cafe"
  },
  "attendees": [
    {
      "emailAddress": {
        "address":"adelev@contoso.onmicrosoft.com",
        "name": "Adele Vance"
      },
      "type": "required"
    }
  ]
}