I've successfully deployed a SharePoint Hosted App to Office 365 and my local on premise installation. All the app aims to do is call the REST API for the user profile manager to get the profile properties of a user. No matter how I try to call the API it fails.
1) If I try to call it using $.getJson
and the url as http://host web url/_api/SP.UserProfiles.PeopleManager/GetMyProperties
it fails for cross domain call.
2) If I try to use the request executer and the url as http://app web url/_api/SP.UserProfiles.PeopleManager/GetMyProperties
it fails (not found).
3) If I try to use the request executer and the url as http://app web url/_api/SP.AppContextSite(@t)/SP.UserProfiles.PeopleManager/GetMyProperties?@t='" + encodeURIComponent(hostweburl) + "'"
; it fails on access denied and/or not found.
If I use the exact same SP.AppContextSite
and tries to simply get the title of the web it works just fine.
Is the SP.AppContextSite
limited to just the web object? Is there any way to call the user profiles REST API from a SharePoint Hosted App?