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