SharePoint userProfileProperties JSOM (JavaScript Object Model)

Home / Uncategorized / SharePoint userProfileProperties JSOM (JavaScript Object Model)

Question:
I am tryin to get some info from PeopleManager.getMyProperties() function. I get the object,some values are null.when i check it from User Profile from Management,I can see the value. How can i fix this one ?

There is my working code to get object.
Note : I want to access Custom Property from User Profile which I created before. I can see the property in the object but value is not coming.

Thank You All..
$(document).ready(function(){
SP.SOD.executeOrDelayUntilScriptLoaded(loadUserData, ‘SP.UserProfiles.js’);
});

var userProfileProperties;

function loadUserData(){

//Get Current Context
var clientContext = new SP.ClientContext.get_current();

//Get Instance of People Manager Class
var peopleManager = new SP.UserProfiles.PeopleManager(clientContext);

//Get properties of the current user
userProfileProperties = peopleManager.getMyProperties();

clientContext.load(userProfileProperties);

//Execute the Query.
clientContext.executeQueryAsync(onSuccess, onFail);

}

function onSuccess() {
console.log(userProfileProperties)
}

function onFail(sender, args) {
console.log("Error: " + args.get_message());
}


Answer:

Read more

Leave a Reply

Your email address will not be published. Required fields are marked *