I'm trying to get access to context in a provider hosted Sharepoint App, so that I can use the following to move folders via javascript:


When the app is initialized I get an access token I used to make rest queries with no problem and I also get the SPHostWebUrl as a query string parameter (I don't get a SPAppWebUrl in the query string).

Here is how I was trying to get the correct context (I am using the SPHostWebUrl instead of SPAppWebUrl), but it always triggers the error:

    var spHostWebUrl =decodeURIComponent(getQueryStringParameter("SPHostWebUrl"));
    var ctx = new SP.ClientContext(spHostWebUrl);
    var factory = new SP.ProxyWebRequestExecutorFactory(spHostWebUrl);
    var web = ctx.get_web();

     function () {
     alert("sucess"); },
     function (a, b) {
     alert("error"); }

Your Answer

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

Browse other questions tagged or ask your own question.