0

Is it possible to send Request-headers to SharePoint Rest API which will be then present with the same value in the response?

Here is an example what I want to do:

getUserId: function (loginName, callback) {

    /// according to the environment.
    var executor = new SP.RequestExecutor(decodeURIComponent(AppCoreFunctions.getAppRelativeUrls().appweburl));
    var url = AppCoreFunctions.getAppRelativeUrls().appweburl + "/_api/SP.AppContextSite(@target)/web/siteusers(@v)?@v='" + SP.Utilities.HttpUtility.urlKeyValueEncode(loginName) + "'&@target='" + AppCoreFunctions.getAppRelativeUrls().hostweburl + "'";
    executor.executeAsync({
        url: url,
        method: "GET",
        headers: {
            "accept": "application/json; odata=verbose",
            "__xyz": "123" //<-- I want to be able to read this data from response
        },
        success: function (data, loginName) {
            var JSONData = JSON.parse(data["body"]);
            callback(JSONData);
        },
        error: function (sender, args) {
            console.log(sender);
        }
    });
},
0

No, that is impossible, unless you can change how the receiving server responds, so in SharePoints case only Microsoft can make that change

Use either

  • Scope binding
  • Cookies
  • Local Storage

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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