Quantcast
Channel: Developing Apps for SharePoint 2013 forum
Viewing all articles
Browse latest Browse all 8089

SharePoint hosted app part and SPHostUrl + SPAppWebUrl

$
0
0

Hi,

I have sharepoint hosted app that gets hostweburl and appweburl with the next lines 

function getUrl() {
    hostweburl = getQueryStringParameter("SPHostUrl");
    appweburl = getQueryStringParameter("SPAppWebUrl");
    hostweburl = decodeURIComponent(hostweburl);
    appweburl = decodeURIComponent(appweburl);
    var scriptbase = hostweburl + "/_layouts/15/";
    $.getScript(scriptbase + "SP.Runtime.js",
        function () {
            $.getScript(scriptbase + "SP.js",
            function () { $.getScript(scriptbase + "SP.RequestExecutor.js", execOperation); }
            );
        }
    );
}

function execOperation() {
    context = new SP.ClientContext(appweburl);
    appContextSite = new SP.AppContextSite(context, hostweburl);
}

And this works fine. But when I'm creating app part those hostweburl and appweburl fields are undefined. So I cant get the context and everything is broken. Is this done in some other way in app parts? 


Viewing all articles
Browse latest Browse all 8089

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>