如何使用Microsoft图形添加多个日历事件

问题描述 投票:1回答:1

我能够创建一个Outlook日历事件,但是如何同时创建多个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": "[email protected]",
            "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 outlook-restapi
1个回答
0
投票

当前'Events' api的post方法允许只向单个事件发送带有信息的请求正文。

为了在单个请求中创建多个事件,您可以将对各种终结点的请求作为请求主体进行批处理并将其发布到Batch Graph Request Endpoint

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

© www.soinside.com 2019 - 2024. All rights reserved.