使用NodeJS在Outlook中创建日历事件

问题描述

我需要使用NodeJS脚本在Outlook中创建日历事件。我已经搜索了所有地方并尝试了不同的npm软件包,但是我没有解决方案。

我尝试了 Node-Outlook NPM软件包,但是文档不清楚,如如何创建日历事件。

var outlook = require('node-outlook');

var newEvent = {
    "Subject": "discuss the Calendar REST API","Body": {
        "ContentType": "HTML","Content": "I think it will meet our requirements!"
    }
};

let createEventParameters = {
    token: ['Access token'],event: newEvent,user : <user>
};
outlook.calendar.createEvents(createEventParameters,function (error,event) {
    if(error) {
        console.log(error);                 
    } else {
        console.log(event);                         
    }
});

此npm包返回错误

REST request returned 401; body: {"error":{"code":"InvalidAudience","message":"The audience claim value is invalid 'aud'.

请帮助我解决此问题,如果您知道创建日历事件的任何其他方法,请提出建议。

谢谢

解决方法

尝试设置此权限 日历.读写 在 Azure 配置中的 API 权限