3

我正在尝试拒绝使用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."
  }
}
4

1 回答 1

2

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.

于 2015-12-21T15:39:01.927 回答