【问题标题】:How to add multiple calendar events using Microsoft graph如何使用 Microsoft graph 添加多个日历事件
【发布时间】:2019-08-08 06:41:09
【问题描述】:

我可以创建单个 Outlook 日历事件,但是如何同时创建多个,有什么方法可以使用 Microsoft graph api?

我尝试将一系列事件传递给 api,抛出 JSON 错误

var event = {
    "subject": "Let's go for lunch",
    "body": {
        "contentType": "HTML",
        "content": "Does late morning work for you?"
    },
    "start": {
        "dateTime": "2017-04-15T12:00:00",
        "timeZone": "Pacific Standard Time"
    },
    "end": {
        "dateTime": "2017-04-15T14:00:00",
        "timeZone": "Pacific Standard Time"
    },
    "location": {
        "displayName": "Harry's Bar"
    },
    "attendees": [{
        "emailAddress": {
            "address": "samanthab@contoso.onmicrosoft.com",
            "name": "Samantha Booth"
        },
        "type": "required"
    }]
}


client
    .api('/me/events')
    .post(event, (err, res) => {
        console.log(res)
    })

对于一个事件它正在工作,但我需要添加多个事件,比如下午 2 点到 3 点和下午 6 点到 7 点,因为循环消耗太多时间

【问题讨论】:

    标签: javascript node.js outlook microsoft-graph-api outlook-restapi


    【解决方案1】:

    目前'Events' api 的 post 方法只允许发送包含单个事件信息的请求正文。

    为了在单个请求中创建多个事件,您可以将各种端点的请求批处理为请求正文并将其发布到 Batch Graph Request Endpoint.

    您可以找到更多信息 Json Batching Multiple Graph Requests here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-10-30
      • 1970-01-01
      • 1970-01-01
      • 2023-03-24
      • 2020-08-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多