//SP.SOD.executeOrDelayUntilScriptLoaded(getUserProperties, 'SP.UserProfiles.js');
// SP.SOD.executeFunc('userprofile', 'SP.UserProfiles.PeopleManager',getUserProperties);
var userProfileProperties;
function getUserProperties()
{
var clientContext = new SP.ClientContext.get_current();
var peopleManager = new SP.UserProfiles.PeopleManager(clientContext);
userProfileProperties = peopleManager.getMyProperties();
clientContext.load(userProfileProperties);
clientContext.executeQueryAsync(onRequestSuccess, onRequestFail);
}
function onRequestSuccess()
{
var userName = userProfileProperties.get_userProfileProperties()['PreferredName'];
var Officelocation = userProfileProperties.get_userProfileProperties()['Office'];
alert(userName);
alert(Officelocation);
}
function onRequestFail(sender, args)
{ }