Forum Discussion

Milap Shah's avatar
Milap Shah
Copper Contributor
Sep 08, 2016

O365 Exchange Rest API not working from jQuery

O365 Exchange REST api not working when invoking from jquery/javascript.


Here is a rest api documentation: https://msdn.microsoft.com/en-us/office/office365/api/calendar-rest-operations


I am trying to display my O365 exchange calendar events using jquery on SharePoint Landing Page. Keep in mind that this will be come CORS call and hence I am using JSONP.
but this is throwing "unexpected token" response in the result. I see the response via fiddler but it's just not able parse it.


Sample Code:

$.ajax({
url: "https://outlook.office365.com/api/beta/users/me/calendarview?startDateTime=9/5/2016&endDateTime=9/10/2016",
type: "GET",
crossDomain: true,
dataType: "jsonp",
jsonp: false,

success: function (data) {
console.log('hello');

},
error: function (xhr, status) {
console.log("error");
}
});

No RepliesBe the first to reply

Resources