Reputation: 689
I am trying to decline the event created using Outlook REST API. I had the id of the event which was created. My request includes Node.js Code :
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();
I have checked that the event was present but still this error came.
Sample Request
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"}
Sample Response Headers
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
Sample Response Body
{
"error": {
"code": "ErrorItemNotFound",
"message": "The specified object was not found in the store."
}
}
Upvotes: 3
Views: 349
Reputation: 2893
There is a property called iCalUid that is the same for an event both in the organizer's and attendee's mailbox. However, it looks like $filter using this property isn't yet supported. We will look into adding this. In the meantime, if you know other details of the event such as start time and end time, you can ask for all events during that timeframe, and confirm you are declining the correct event by comparing iCalUid property of the event in the organizer's mailbox with iCalUid property of the event in the attendee's mailbox.
Upvotes: 2