0

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
            }
        );
    }

1 Answer 1

1

This error occurs since SP.RequestExecutor object does not contain method executeQueryAsync.

Probably you meant SP.RequestExecutor.executeAsync Method, if so, replace the line

executor.executeQueryAsync(...)

with

executor.executeAsync(...)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.