Skip to main content

Posts

Showing posts from September, 2015

Access Host Web from App web in SharePoint hosted app - Office 365

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.. ");

Azure Active Directory GraphClient AuthorizationException

Error : Microsoft.Azure.ActiveDirectory.GraphClient.AuthorizationException Insufficient privileges to complete the operation Solution: Under Configure under Permissions to other applications Add application - Windows Azure Active Directory Give the following permissions Read directory data Sign in and read user profile Stack Trace :  Microsoft.Azure.ActiveDirectory.GraphClient.AuthorizationException was unhandled by user code   HResult=-2146233088   Message=Insufficient privileges to complete the operation.   Source=Microsoft.Azure.ActiveDirectory.GraphClient   Code=Authorization_RequestDenied   ErrorMessage=Insufficient privileges to complete the operation.   ResponseUri=https://graph.windows.net/ /users/ ?api-version=2013-11-08   StackTrace:        at Microsoft.Azure.ActiveDirectory.GraphClient.ConnectionWrapper.InvokeNetworkOperation[T](Func`1 action)        at Microsoft.Azure.ActiveDirectory.GraphClient.ConnectionWrapper.DownloadData(String address,