I am trying to get both personal calendar and shared calendar in an office 365 account using RESTapi. Since currently Oauth2 doesn't support accessing shared calendar, I'm testing my code with basic authorization.
I have three calendars in my account:
- user1@domain.com(own calendar)
- user2@domain.com(shared calendar)
- user3@domain.com(shared calendar)
Using following end points I was able to get events using basic authorization:
https://outlook.office365.com/ews/odata/Users('user1@domain.com')/Events
The strange part is for the past two days I'm not able to get events for user1@domain.com and user2@domain.com using the same end point. I get the following error when I try to access the events:
{"@odata.context":"https://outlook.office365.com/ews/odata/$metadata#Users('user1@domain.com')/Events","value":[{"error":{"code":"ErrorInternalServerError","message":"Object reference not set to an instance of an object."}}
But I can still access events for user3@domain.com using same endpoint and basic authentication.
I also tried to access own calendar using oauth2. I get similar error
{"value":[{"error":{"code":"ErrorInternalServerError","message":"Object reference not set to an instance of an object."}}
But I can successfully talk to calendar endpoint
I was wondering if anyone had seen this error before. Any help/suggestions are greatly appreciated.