Here is a snippet to save your day. There are many snippets out there showing you how to do cross domain calls, but none of them complete. Here is a sample to access host web components from a SharePoint hosted app or add in. Keywords: SharePoint, access host web, sharepoint online, JSOM, CSOM, SharePoint hosted app, Office 365. 'use strict'; //URLs var hostweburl; var appweburl; var context; var appContextSite; var factory; var context = SP.ClientContext.get_current(); var appContextSite; var rootweb ; var roleDefinitions ; (function () { $(document).ready(function () { hostweburl = decodeURIComponent(getQueryStringParameter("SPHostUrl")); appweburl = decodeURIComponent(getQueryStringParameter("SPAppWebUrl")); var scriptbase = hostweburl + "/_layouts/15/"; $.getScript(scriptbase + "SP.Runtime.js", function () { $('#message').append(" Getting Scripts.. "); ...
My place to share my thoughts on Technology, Leadership, Movies, Books, Philosophy and anything that gets me thinking.