我正在尝试从 PeopleManager.getMyProperties() 函数中获取一些信息。我得到了对象,有些值为空。当我从管理的用户配置文件中检查它时,我可以看到该值。我该如何解决这个问题?
有我的工作代码来获取对象。
注意:我想从我之前创建的用户配置文件中访问自定义属性。我可以看到对象中的属性,但值没有出现。
谢谢你们..
$(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());
}