Pregunta

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?

¿Fue útil?

Solución

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);
});

get User Profile properties using SPFx and PnP JS

enter image description here

Licenciado bajo: CC-BY-SA con atribución
scroll top