Can I deploy a SharePoint Add-In with User Profiles (Social) | Read to the SharePoint AppStore?

Occasional Contributor

I'd like to be able to programmatically retrieve a user's name and manager using code similar to the following:

    using (var clientContext = TokenHelper.GetClientContextWithAccessToken(hostWeb.ToString(), accessToken))
        var peopleManager = new PeopleManager(clientContext);
        var personProperties = peopleManager.GetPropertiesFor(loginName);
        property = personProperties.UserProfileProperties[requestedProperty].ToString();
        return property;

On an app without the User Profiles (Social) permission, I get an Access Denied on the ExecuteQuery(). I assume you need the User Profiles (Social) | Read permission on the app to be able to do this. I attempted to side-load an app with this permission on a dev site and was told I needed to be a Tenant Administrator which now has me doubting whether this permission is valid for a store-based app.


Is it possible to access user data such as PreferredName and Manager using the PeopleManager in an app on the SharePoint AppStore? If not, is it possible to access this data in a non-interactive fashion using Microsoft Graph?


[Repost from my SO question here:]

4 Replies

you can not get the propties of a profile where you have not the right to see it.

var clientContext = new SP.ClientContext.get_current();
var peopleManager = new SP.UserProfiles.PeopleManager(clientContext);
var personProperties = peopleManager.getMyProperties();
clientContext.executeQueryAsync(function () {
// First time experience completed
var prop= personProperties.get_userProfileProperties()['prop'];


a example above. and please be aware you need to us  SP.SOD.executeOrDelayUntilScriptLoaded

@Deleted wrote:

you can not get the propties of a profile where you have not the right to see it.


Are you saying that it is not possible for a provider-hosted app from the App Store to have permissions to see this user profile data?

It depends if your app has tennant permissions it would see them but i guess you did not include that in your permissions.

Can an app with Tenant permissions be on the App Store?