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

Access is denied in MicrosoftAjax.js in SharePoint-Hosted app when querying host web list items

$
0
0

Whenever, I try to query list items from the host web in my app, I am getting access denied in MicrosoftAjax.js on the point where it is calling xmlHttpRequest.open().  The code is hosted in a Client Web Part in this case.  I'm following the basic examples as seen on this article and I thought it should work.  The basic code:

context = new SP.ClientContext(spHostUrl);web = context.get_web();

   var list = web.get_lists().getByTitle('My List').val());

    var camlQuery = new SP.CamlQuery();
    camlQuery.set_viewXml('').val());

    this.listItems = list.getItems(camlQuery);
    context.load(listItems);

    context.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded),
        Function.createDelegate(this, this.onQueryFailed));

I don't need the cross-domain library since it is SharePoint hosted right?  I tried that approach anyways and it didn't work either.  It gave me "App Web is not deployed for this app's request url".

I also tried requesting Web and Lists access in the App Manifest but that did not make any difference either.

Corey Roth - SharePoint Server MVP blog: www.dotnetmafia.com twitter: @coreyroth



Viewing all articles
Browse latest Browse all 8089

Trending Articles



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