I'm trying to get some user properties and alert them (I'm going to put them i labels later but just for now I'm using alert). I'm using a content editor with this code:
SP.SOD.executeFunc('sp.js','SP.ClientContext',runthiscode);
function runthiscode()
{
SP.SOD.executeFunc('SP.UserProfiles.js','SP.UserProfiles',getUserProperties);
}
var personProperties;
function getUserProperties() {
var clientContext = new SP.ClientContext.get_current();
var peopleManager = new SP.UserProfiles.PeopleManager(clientContext);
personProperties = peopleManager.getMyProperties();
clientContext.load(personProperties);
clientContext.executeQueryAsync(onRequestSuccess, onRequestFail);
}
function onRequestSuccess() {
alert(personProperties.get_displayName());
alert(personProperties.get_pictureUrl());
alert(personProperties.get_loginName());
}
function onRequestFail(sender, args) {
alert("error msg");
}
The alert with loginName doesn't work, why is that? Why can I get pictureUrl and displayName but no other properties? Is there any list of properties available for reference?
get_accountName()
, I hope this will work