Cross-Domain calls using JavaScript in SharePoint Apps

Posted by Sahil Malik on Win Smarts See other posts from Win Smarts or by Sahil Malik
Published on Fri, 21 Jun 2013 14:54:44 GMT Indexed on 2013/06/24 16:32 UTC
Read the original article Hit count: 826

Filed under:

SharePoint, WCF and Azure Trainings: more information

Sounds simple enough right? You’ve probably done $.ajax, and jsonp? Yeah all that doesn’t work in SharePoint. The main reason being, those calls need to work under the app’s credentials. So instead here is what a SharePoint app does, It downloads a file called ~hostweburl/_layouts/15/SPRequestExecutor.js. This file creates an IFrame in your page which then downloads a file called ~appweburl/_layouts/15/AppWebproxy.aspx Then all calls that look like the below, are routed via AppWebProxy and run on the server under the apps identity. 1: var executor = new SP.RequestExecutor(this.appweburl); 2: var url = this.appweburl + "/_api/SP.AppContextSite(@target)/web?" + "@target='" + this.hostweburl +

Read full article ....

© Win Smarts or respective owner

Related posts about sharepoint