我正在尝试拒绝使用Outlook REST API创建的事件。我有创建的事件的 ID。我的请求包括 Node.js 代码:
var body =JSON.stringify(
{
"Comment": "Sorry, maybe next time!",
"SendResponse": "true"
});
var options1 = {
host : 'outlook.office365.com',
port : 443,
method : 'POST',
headers : {
'Authorization' : 'Bearer' + token,
'Content-Type': 'application/json',
'Content-Length': Buffer.byteLength(body)
},
json : body,
path : '/api/v2.0/me/events/EVENT_ID_RECEIVED/decline'
}
};
var str="";
var apiCall=https.request(options1,function(response){
response.on('data',function(chunk){
str += chunk;
});
response.on('end' , function(){
console.log("data received is : "+response.data);
console.log("value is : "+str);
});
response.on('error', function(e) {
console.log("error received : "+e.message);
});
});
apiCall.write(body);
apiCall.end();
我检查了该事件是否存在,但仍然出现此错误。
样品请求
POST //api/v2.0/me/events/GeneratedEventIdWhileCreatingCalender/decline HTTP/1.1
Host: outlook.office365.com
Content-Type: application/json
Cache-Control: no-cache
Postman-Token: 9c925f4a-58df-4409-ca51-278590cfddd1
{"Comment":"Sorry,maybe next time!","SendResponse":"true"}
示例响应标头
Access-Control-Allow-Origin → *
Access-Control-Max-Age → 86400
Cache-Control → private
Content-Type → application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8
Date → Fri, 18 Dec 2015 05:02:29 GMT
OData-Version → 4.0
Server → Microsoft-IIS/8.0
Transfer-Encoding → chunked
X-AspNet-Version → 4.0.30319
X-BEServer → HK2PR0301MB1154
X-BackEndHttpStatus → 404
X-CalculatedBETarget → HK2PR0301MB1154.apcprd03.prod.outlook.com
X-DiagInfo → HK2PR0301MB1154
X-Powered-By → ASP.NET
request-id → 6ab4e13e-f8bd-45c8-a80a-c31f8c580141
示例响应正文
{
"error": {
"code": "ErrorItemNotFound",
"message": "The specified object was not found in the store."
}
}