【发布时间】:2017-02-14 08:08:00
【问题描述】:
我希望能够使用类似于以下的代码以编程方式检索用户名和经理:
using (var clientContext = TokenHelper.GetClientContextWithAccessToken(hostWeb.ToString(), accessToken))
{
var peopleManager = new PeopleManager(clientContext);
var personProperties = peopleManager.GetPropertiesFor(loginName);
clientContext.Load(personProperties);
clientContext.ExecuteQuery();
property = personProperties.UserProfileProperties[requestedProperty].ToString();
return property;
}
在没有User Profiles (Social) 权限的应用上,我在ExecuteQuery() 上收到拒绝访问。我假设您需要应用程序的User Profiles (Social) | Read 权限才能执行此操作。我试图在开发网站上加载具有此权限的应用程序,并被告知我需要成为租户管理员,现在我怀疑此权限是否对基于商店的应用程序有效。
是否可以在 SharePoint AppStore 上的应用程序中使用 PeopleManager 访问用户数据,例如 PreferredName 和 Manager?如果没有,是否可以使用 Microsoft Graph 以非交互方式访问这些数据?
【问题讨论】:
标签: sharepoint sharepoint-online microsoft-graph-api sharepoint-apps sharepoint-addin