简体   繁体   中英

Create Calendar Event in outlook with NodeJS

I need to create a calendar event in outlook using NodeJS script. I have searched every where and tried different npm packages but i didn't got the solution.

I have tried Node-Outlook NPM package but the documentation is not clear like how to create calendar event.

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);                         
    }
});

This npm package return error :

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

Please help me to solve this problem and also if you know any different way to create calendar event please suggest.

Thanks

尝试在 Azure 配置中的 API 权限中设置此权限 Calendars.ReadWrite

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM