I'm trying to write a simple SP Hosted WebPart that makes a rest call to Yammer but when I try making a call with SP.RequestExecutor.executeQueryAsync(), I get an error message: Object doesn't support property or method 'executeQueryAsync'
function () {
//Get the URI decoded SharePoint site url from the SPHostUrl parameter.
var spHostUrl = decodeURIComponent(getQueryStringParameter('SPHostUrl'));
var appWebUrl = decodeURIComponent(getQueryStringParameter('SPAppWebUrl'));
execOperation();
yammerOperation(appWebUrl);
// Function to execute SP basic operations.
function execOperation() {
// SP Call - get context and then username
context = new SP.ClientContext.get_current();
web = context.get_web();
getUserName();
}
// Function to execute Yammer operations
function yammerOperation(appWebUrl) {
var executor = new SP.RequestExecutor(appWebUrl);
executor.executeQueryAsync(
{
url: "https://www.yammer.com/api/v1/groups/for_user/xxxxxxxx.json",
method: "GET",
crossDomain: true,
headers: {
"Accept": "application/json;odata=verbose",
"Authorization": "Bearer xxxxxxxxxxxx"
},
dataType: "json",
success: successHandler,
error: errorHandler
}
);
}