Microsoft Graph有时会返回一个奇怪的结果
客户端错误:
GET https://graph.microsoft.com/v1.0/me/calendars resulted in a 404 Not Found
{
"error": {
"code": "ErrorInvalidUser",
"message": "The requested user 'chrisb@domain_name.com' is invalid.",
"innerError": {
"request-id": "c229f76d-a9d0-4441-b663-b34f4996cddb",
"date": "2017-11-21T01:23:18"
}
}
}
这个问题对我来说似乎很奇怪,因为我知道用户存在,因为我可以在它下面登录。
我的所作所为:
问题:
该错误意味着什么 - 因为用户100%出现在Microsoft(我能够从刷新令牌获取身份验证令牌并且能够在该用户下登录)
答案 0 :(得分:0)
我只对某些特别有非常老帐户的MS用户遇到了同样的问题,我正在传递Microsoft用户的电子邮件,例如:following 让userInfo = {电子邮件:user.email} let apiParams = {令牌:access_token,事件:newEvent,calendarId:msUserInfo.calendarId,user:userInfo}
解决方案: 遇到问题后,我从api中删除了“ user”参数,它对我有用。 我现在设定如下。 我用过Node,节点外观
const outlook = require('node-outlook');
let newEvent = {
"Subject": objUpdate.title,
"Body": {
"ContentType": "HTML",
"Content": objUpdate.description
},
"Start": {
"DateTime": moment('startDate').toISOString(),
"TimeZone": objUpdate.timeZone
},
"End": {
"DateTime": moment('endDate').toISOString(),
"TimeZone": objUpdate.timeZone
}
};
outlook.calendar.createEvent({token: access_token, event: newEvent ,calendarId: msUserInfo.calendarId
},async function(error, result){
if (error) {
console.log("error: -",error)
throw "Microsoft Calendar Api Err."
}else if (result) {
console.log("Result -")
}
});