Retrieving user profile properties in Application Customizer (SharePoint Framework)
-
29-12-2020 - |
質問
I'm currently working with the SharePoint Framework Extensions that are currently in developer preview – specifically Application Customizers. How can I lookup user profile properties for the current user?
解決
You can use PnP JS to get the entire user profile properties as shown below :
pnp.sp.profiles.myProperties.get().then(function(result) {
var userProperties = result.UserProfileProperties;
var userPropertyValues = "";
userProperties.forEach(function(property) {
userPropertyValues += property.Key + " - " + property.Value + "<br/>";
});
document.getElementById("spUserProfileProperties").innerHTML = userPropertyValues;
}).catch(function(error) {
console.log("Error: " + error);
});
所属していません sharepoint.stackexchange