Dennis Shtemberg
Dennis Shtemberg

Reputation: 84

Office 365 API: Error calling Delete Event

Getting an internal server error (500) when making a rest call to delete an event.

Request:
DELETE /api/v1.0/Users('[email protected]')/Events/AAMkADZlN2MxYmJhLWUzMGUtNGY3Zi05YzBjLTdhNTExMzc3NmY4YgBGAAAAAABuvuSdIZ-9TLUADSOLnckDBwAYbp8b1lFySrerP-06-Cx4AAAAAAENAAAYbp8b1lFySrerP-06-Cx4AAACVeUmAAA= HTTP/1.1
Host: outlook.office365.com
Authorization: Basic dXNlcjFAbXljb21wYW55Lm9ubWljcm9zb2Z0LmNvbTpwYXNzd29yZA==
Cache-Control: no-cache

Request URL: https://outlook.office365.com/api/v1.0/Users('[email protected]')/Events/AAMkADZlN2MxYmJhLWUzMGUtNGY3Zi05YzBjLTdhNTExMzc3NmY4YgBGAAAAAABuvuSdIZ-9TLUADSOLnckDBwAYbp8b1lFySrerP-06-Cx4AAAAAAENAAAYbp8b1lFySrerP-06-Cx4AAACVeUmAAA=
Request Method: DELETE
Status Code: 500 Internal Server Error
Response:
{
    "error": {
        "code": "ErrorInternalServerError",
        "message": "Object reference not set to an instance of an object."
    }
}

GET and PATCH both work.

Upvotes: 0

Views: 699

Answers (2)

Karol Jochelson
Karol Jochelson

Reputation: 291

Microsoft: "It's interesting you can get GET and PATCH to work using Basic authentication in a delegate scenario". All the methods except delete (by other user) still work including create. I think this is a Microsoft bug that no developer wants to sit an fix. All other responses come back with some form of explanation as to why you can't delete, but in this case its an "Internal Server Error" which tells me that something bad happened server side.

I have tried the client credential route but it turns out you have to build a x.509 certificate and many other steps need to be taken which are not mentioned in the REST API. This might help getting the client credentials working as a daemon. https://gist.github.com/NGMarmaduke/a088943edbe4e703129d

Upvotes: 1

Jason Johnston
Jason Johnston

Reputation: 17692

That should work if you authenticate as the mailbox owner. However, delegate access (accessing User1's mailbox as User2) isn't supported by the REST APIs currently. It's interesting you can get GET and PATCH to work using Basic authentication in a delegate scenario. However, I should warn that Basic auth for the REST APIs will be discontinued in the future. The supported way of using these API's is via an OAuth token.

What is your end goal? Is delegate access a key component to your solution, or do you just need for your app to be able to act on user's calendars?

Upvotes: 0

Related Questions