Skip to main content


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

Azure Active Directory GraphClient AuthorizationException

Error : Microsoft.Azure.ActiveDirectory.GraphClient.AuthorizationException Insufficient privileges to complete the operation


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
  Message=Insufficient privileges to complete the operation.
  ErrorMessage=Insufficient privileges to complete the operation.
       at Microsoft.Azure.ActiveDirectory.GraphClient.ConnectionWrapper.InvokeNetworkOperation[T](Func`1 action)
       at Microsoft.Azure.ActiveDirectory.GraphClient.ConnectionWrapper.DownloadData(String address, WebHeaderCollection additionalHe…