-1

I have the following Ajax call:

var baseurl = Office.context.mailbox.restUrl;
var getMessageUrl = baseurl + "/v2.0/me/messages/" + rest_id + "?$select=SingleValueExtendedProperties&$expand=SingleValueExtendedProperties($filter=PropertyId eq 'String 0x007D')";


$.ajax({
        url: getMessageUrl,
        dataType: "jsonp",
        headers: {
            "Authorization": "Bearer " + rest_token,
            "Accept": "application/json; odata.metadata=none"
        },
        error: function (xhr, ajaxOptions, thrownError) {
            $('.resultsScore').text(xhr.statusText);
        }
    }).done(function (item) {

However, this always throws an error (the error function is always entered). If I used dataType: "json", it works fine. What am I doing wrong? Why can I not use jsonp in this way?

BigDataFiles
  • 105
  • 1
  • 10

1 Answers1

-1

The error is almost certainly because the response isn't JSONP.

There are several reasons that might be. The service you are calling might simply not support it. In addition, JSONP requests do not support the setting of custom headers, so your Authorization will be missing.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335